Tonic UI
Getting StartedColor ModeColor StyleVersionsContributing
THEME
BordersBreakpointsColorsOutlinesPositionsSpacingSizesShadowsTypography
BUILDING BLOCKS
BoxControlBox
UTILITIES

Alert

An alert is used to convey important information to the user through the use of contextual types, icons, and colors.

Import

Usage

Variants

You can use the variant prop to change the appearance of the alert. The variants come in two variations: solid and outline.

Solid

The solid variant is used to indicate an important message.

EDITABLE EXAMPLE

Outline

The outline variant is useful for displaying a contextual alert that is not a part of the primary flow of the application.

EDITABLE EXAMPLE

Severity levels

The severity prop can be used to specify the severity level of the alert. The severity levels are: success, info, warning, and error. The default severity level is success.

EDITABLE EXAMPLE

icon prop

The icon prop allows you to specify an icon to be displayed in the alert. If not specified, the default icon will be used based on the severity prop.

EDITABLE EXAMPLE

isClosable prop

Set isClosable to true to make the alert closable. The default value is false.

EDITABLE EXAMPLE

Alert actions

An alert action is a button or link to trigger an action. It is used to provide additional context to the user.

The action button is usually aligned to the right of the alert. You can use justifyContent to align the action button to the right.

EDITABLE EXAMPLE

Formatted text

You can use the Text component to format text.

EDITABLE EXAMPLE

Transition effects

To animate the alert, you can use a transition component to apply an animation effect.

EDITABLE EXAMPLE

Props

NameTypeDefaultDescription
isClosablebooleanIf true, a close button will appear on the right side.
onClosefunctionA callback called when the close button is clicked.
variantstring'solid'The variant to use. One of: 'solid', 'outline'
severitystring'success'The severity level to use. One of: 'success', 'info', 'warning', 'error'
iconstring | ReactNode | falseOverride the icon displayed before the children. Unless provided, the icon is mapped to the value of the severity prop.