Alert

Show a message that stays in the page, with an optional title, icon and close button.

General

The basic Alert usage. Errors and warnings are announced right away by a screen reader, the other types wait for a pause.

Variants

Use filled, light or subtle to change how much the color takes over.

Dismissible

onClose shows a close button. Hide the alert in your state, and bring it back when the cause returns.

With an icon and an action

Put an icon before the text, and any element, such as a button, after it.

APIs

Alert.Props

AttributeDescriptionTypeAccepted valuesDefault
typecolor of the alert'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info'-default
titlebold first lineReactNode--
iconelement before the textReactNode--
filledsolid colorboolean-false
lighttinted backgroundboolean-false
subtletext only, no borderboolean-false
onCloseshows a close button and calls it on click() => void--
closeLabelaccessible name of the close buttonstring-Close
roledefaults to alert for errors and warnings, status otherwisestring--
...native propsHTMLAttributes--
Edit this page on GitHub