Feedback
Alert
A persistent message in the page.
Variants
A tinted panel with a coloured icon. Text uses the status -text tokens, so contrast holds in light and dark.
Heads up
Your workspace has 3 pending invitations.
New billing cycle
Invoices are now issued on the 1st of each month.
Domain verified
northwind.example is ready to send email.
Storage almost full
You have used 9.2 GB of your 10 GB plan.
Payment failed
The card ending 4242 was declined. Update it to keep your subscription active.
When to use
- A message that belongs to the page and stays until the situation changes: a failed payment, a limit reached, a verified domain.
- Context for a whole section or screen, with an action to resolve it.
Not for: a confirmation of something the user just did (use a toast), a decision that blocks the user (use a dialog), or field-level errors (put them next to the field).
With actions
Put buttons in AlertActions. Use small buttons; one primary at most.
Your trial ends in 3 days
Add a payment method to keep your 12 projects and 4 team members.
Dismissible
DismissibleAlert adds a × button. It fades and collapses away so the content below glides up, then unmounts. Control it with open or let it manage itself.
Welcome to Atlas
Your workspace is ready. Invite your team whenever you like.
API
Alert
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | 'default' | 'info' | 'success' | 'warning' | 'destructive' | 'default' | Meaning and colour. Each status variant has its own icon. |
| banner | boolean | false | Full-width strip, square corners, no side borders. |
| icon | ReactNode | false | — | Replace the icon, or false for none. |
| role | 'alert' | 'status' | — | None by default. See Accessibility. |
| ...props | HTMLAttributes<HTMLDivElement> | — | Forwarded to the root, including ref and className. |
DismissibleAlert
| Prop | Type | Default | Description |
|---|---|---|---|
| open / defaultOpen / onOpenChange | boolean | true | Controlled or uncontrolled visibility. |
| dismissLabel | string | 'Dismiss' | Accessible name of the × button. |
| ...props | AlertProps | — | Everything Alert accepts. |
Parts: AlertTitle, AlertDescription, AlertActions. Alert is a Server Component–safe element; only DismissibleAlert is a client component.
Accessibility
- An alert is page content, so it has
no roleby default and is read in order with the rest of the page. - Add
role="alert"only for something urgent that appears because of what the user just did (a failed save, a declined payment): screen readers interrupt whatever they are saying. Do not use it for messages present on load. - Use
role="status"for a polite update that appears after load (for example, “Sync complete”). - Colour is never the only signal: every status variant has an icon and a title.
- The × button is a real button with a label; keyboard focus shows a ring.
Motion
- Dismissing fades the alert out and collapses its height over 220ms so nothing jumps.
- Reduced motion: the alert still disappears, without the movement.