Alert

Highlights a short, important message inline

Category: display · WCAG 2.2-AA · notification, message, feedback

Variants

Props

PropTypeDefaultDescription
variant'default' | 'info' | 'success' | 'warning' | 'destructive'defaultSelects the visual style variant.
titlestringTitle text for the component.
iconReactNodeIcon element rendered in the component.
dismissiblebooleanfalseWhen true, shows a control to dismiss the component.
onDismiss() => voidCalled when the component is dismissed.
action{ label: string; onClick: () => void }Primary action shown in the component.

Design tokens

When to use

When not to use

How to build an accessible Alert in React →

Examples

Info

<Alert variant="info" title="Heads up">Your trial ends soon.</Alert>

Dismissible

<Alert variant="success" dismissible title="Saved">Changes saved.</Alert>

Actionable

<Alert variant="warning" title="Update available" action={{ label: 'Update now', onClick: update }}>A new version is ready.</Alert>

Related components

← Back to docs