Alert
A notification component for communicating important information or feedback. Automatically applies status-appropriate icons and colors for info, success, warning, and error messages.
Playground
Heads up!
You can add components to your app using the CLI.
<Alert>
<Alert.Title>Heads up!</Alert.Title>
<Alert.Description>
You can add components to your app using the CLI.
</Alert.Description>
</Alert>Variants
Alert
Alert
Alert
Sizes
smdefaultlg| Size | Padding | Title | Description | Icon | Preview |
|---|---|---|---|---|---|
sm | 12px | 13px | 12px | 16px | TitleDescription text |
default | 16px | 14px | 13px | 18px | TitleDescription text |
lg | 20px | 16px | 14px | 20px | TitleDescription text |
Colors
Information
A new software update is available. See what's new in version 3.0.
Success
Your changes have been saved successfully.
Warning
Your trial period will expire in 3 days.
Error
There was a problem processing your request.
Features
Closable
closableenables the close button. UseonCloseto receive the callback.
Saved!
Your changes have been saved.
<Alert color="success" closable onClose={() => setVisible(false)}>
<Alert.Title>Saved!</Alert.Title>
<Alert.Description>Your changes have been saved.</Alert.Description>
</Alert>Custom Icon
iconsets a custom icon, andhideIconhides the icon.
New feature available!
Check out the latest updates.
Simple message without icon
This alert has no icon.
{/* Custom icon */}
<Alert icon={<Rocket className="icon-md" />}>
<Alert.Title>New feature!</Alert.Title>
</Alert>
{/* No icon */}
<Alert hideIcon>
<Alert.Title>Simple message</Alert.Title>
</Alert>Variant × Color Matrix
All 12 combinations across 3 variants and 4 colors
default
Info
This is a default info alert.
Success
This is a default success alert.
Warning
This is a default warning alert.
Error
This is a default error alert.
outline
Info
This is a outline info alert.
Success
This is a outline success alert.
Warning
This is a outline warning alert.
Error
This is a outline error alert.
filled
Info
This is a filled info alert.
Success
This is a filled success alert.
Warning
This is a filled warning alert.
Error
This is a filled error alert.
API
Component Structure
Alert— Pure React.TitleAlert title (h5).DescriptionDescription text (p)Props
Alert (Root)
variant"default""default" | "outline" | "filled"Visual variant (default: tint background, outline: border only, filled: solid)
color"info""info" | "success" | "warning" | "error"Semantic color — auto-determines icon, color, and ARIA role
size"default""sm" | "default" | "lg"Size — controls padding, font, and icon together
closablefalsebooleanShows the close button
onCloseundefined() => voidCallback for the close button
closeIconundefinedReactNodeCustom close icon
iconauto (by color)ReactNodeCustom status icon
hideIconfalsebooleanHides the icon
radius"lg""none" | "sm" | "base" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full"Border radius
| Name | Type | Default | Description |
|---|---|---|---|
variant | "default" | "outline" | "filled" | "default" | Visual variant (default: tint background, outline: border only, filled: solid) |
color | "info" | "success" | "warning" | "error" | "info" | Semantic color — auto-determines icon, color, and ARIA role |
size | "sm" | "default" | "lg" | "default" | Size — controls padding, font, and icon together |
closable | boolean | false | Shows the close button |
onClose | () => void | undefined | Callback for the close button |
closeIcon | ReactNode | undefined | Custom close icon |
icon | ReactNode | auto (by color) | Custom status icon |
hideIcon | boolean | false | Hides the icon |
radius | "none" | "sm" | "base" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | "lg" | Border radius |
Alert.Title
childrenundefinedReactNodeTitle text
classNameundefinedstringAdditional CSS class
| Name | Type | Default | Description |
|---|---|---|---|
children | ReactNode | undefined | Title text |
className | string | undefined | Additional CSS class |
Alert.Description
childrenundefinedReactNodeDescription text
classNameundefinedstringAdditional CSS class
| Name | Type | Default | Description |
|---|---|---|---|
children | ReactNode | undefined | Description text |
className | string | undefined | Additional CSS class |
Anatomy
Best Practices
Do
- ✓Use the appropriate color for the status
- ✓Communicate the message concisely with a title and description
- ✓Use closable for temporary notifications
Don't
- ✕Don't display too many Alerts on one page
- ✕Don't use the default variant for critical errors — use filled
- ✕Don't use Alert for temporary notifications — use Toast
- ✕Don't use Alert when user confirmation is required — use Modal
Alert vs Toast
Both are used for user notifications, but differ in persistence and interaction.
Display
Alert: Fixed in page (persistent)
Toast: Temporary — disappears automatically
Trigger
Alert: On page load or state change
Toast: After user action — as feedback
Content
Alert: Title + description (rich)
Toast: Short message (1–2 lines)
Dismiss
Alert: Manual (closable) or always shown
Toast: Auto-dismissed (after a few seconds)
Use case
Alert: System state, warnings, errors
Toast: Save complete, copy complete, etc.
ARIA
Alert: role="alert" / role="status"
Toast: role="status" + aria-live
| Feature | Alert | Toast |
|---|---|---|
| Display | Fixed in page (persistent) | Temporary — disappears automatically |
| Trigger | On page load or state change | After user action |
| Content | Title + description (rich) | Short message |
| Dismiss | Manual or always shown | Auto-dismissed (after a few seconds) |
| Use case | System state, warnings, errors | Save complete, copy complete |
| ARIA | role="alert" / role="status" | role="status" + aria-live |
Key distinction: Use Alert for persistent in-page status notifications. Use Toast for temporary feedback from user actions.
Accessibility
ARIA / WCAG
role="alert"auto-applied on errorrole="status"for info/success/warning- Close button includes
aria-label="Close" - Decorative icons include
aria-hidden="true"