Alert

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)

Normal
Normal theme
Info
Info theme
Success
Success theme
Warning
Warning theme
Danger
Danger theme
Utility
Utility theme
Clear
Clear 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.

Filled
Filled view
Outlined
Outlined 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.

Vertical
Vertical direction
Horizontal
Horizontal direction

Corners

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

square: Enables squared corners of the alert window.

Rounded
Rounded corners
Square
Square 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 close
Alert 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.

Baseline
Baseline align
Center
Center align

Properties

NameDescriptionTypeDefault
themeAlert appearance"normal" "info" "success" "warning" "danger" "utility" "clear""normal"
sizeAlert size"s" "m" "l""m"
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"
actionsLayoutUsed to control the direction of the action 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

CSS API

NameDescription
--g-alert-paddingSide paddings.
--g-alert-border-radiusBorder radius.
--g-alert-icon-margin-inline-endThe indentation between icon and content part (text content + actions)
--g-alert-close-btn-marginThe indentation between content part (text content + actions) and close button
--g-alert-actions-marginGap between text content and actions.
--g-alert-message-title-indentGap between title and message.
--g-alert-actions-gapGap between action buttons.
--g-alert-title-text-colorTitle color.
--g-alert-title-font-sizeTitle font size.
--g-alert-title-line-heightTitle line height.
--g-alert-message-text-colorMessage color.
--g-alert-message-font-sizeMessage font size.
--g-alert-message-font-weightMessage font weight.
--g-alert-message-line-heightMessage line height.