Alert

Responsable :
IsaevAlexandr
GitHub
theme
view
corners
title
message
import {Alert} from '@gravity-ui/uikit';

Theme

normal: Main theme (used by default).

info: Used for any kind of regular information.

success: Used for positive information.

warning: Used for information that needs attention.

danger: Used for critical errors.

utility: Used for useful tips.

clear: No styles, suitable for usage in other components (for example, as content in Popover)

NormalNormal theme
InfoInfo theme
SuccessSuccess theme
WarningWarning theme
DangerDanger theme
UtilityUtility theme
ClearClear theme

View

filled: Used to adjust the background color of the alert (used by default).

outlined: Used to adjust the border color of the alert.

FilledFilled view
OutlinedOutlined theme

Layout

vertical: Used to direct users to content if there is an actions property with buttons. It enables showing buttons below the text (used by default).

horizontal: Used to direct users to content if there is an actions property with buttons. It enables showing buttons to the right of the text.

VerticalVertical direction
HorizontalHorizontal direction

Corners

rounded: Enables rounded corners of the alert window (used by default).

square: Enables squared corners of the alert window.

RoundedRounded corners
SquareSquare corners

Alert title

title: Alert title. It has a lower priority than Alert.Title.

some text

Alert message

message: Alert message. It should be meaningful enough to fully explain what the alert is about.

onClose

onClose: Callback function called when a user clicks the alert's close button. When this property is defined, the close button will visible.

Alert has closeAlert has close

Align

Determines how the content inside the Alert component is vertically aligned.

baseline: Default alignment.

center: Content is vertically centered within the Alert component. It may be useful if actions take up more space than text, or if the icon must be in the middle of the content.

BaselineBaseline align
CenterCenter align

Properties

NameDescriptionTypeDefault
themeAlert appearance"normal" "info" "success" "warning" "danger" "utility" "clear""normal"
viewEnable/disable background color of the alert"filled" "outlined""filled"
layoutUsed to direct users to content if there is property actions with buttons"vertical" "horizontal""vertical"
cornersUsed for round/square corners of the alert window"rounded" "square""rounded"
titleTitle of the alertstring
messageMessage of the alertReact.ReactNode
onCloseA callback function called when the user clicks the alert's close buttonFunction
actionsArray of buttons or full custom componentsReact.ReactNode "AlertAction"
alignDetermines how content inside the Alert component is vertically aligned"center" "baseline""baseline"
styleHTML style attributeReact.CSSProperties
classNameName of alert classstring
iconOverride default iconReact.ReactNode
qaHTML data-qa attribute, used in tests.string