Alert
Callouts with unmistakable tones — five variants, an icon tile, and an action slot. Never another gray box you have to squint at.
Installation#
pnpm dlx shadcn@latest add @davinciui/alertUsage#
Every variant carries three signals — tinted border, tinted surface, and a tone-matched icon tile — so severity reads instantly in either theme. Titles stay neutral for readability; only destructive alarms the title too. Actions pin to the inline end; the row mirrors automatically in RTL.
Alert ├── AlertIcon ├── AlertBody │ ├── AlertTitle │ └── AlertDescription └── AlertAction
Composition#
Use the following composition to build a Alert:
Alert
├── AlertIcon
├── AlertBody
│ ├── AlertTitle
│ └── AlertDescription
└── AlertActionAPI Reference#
| Prop | Type | Default |
|---|---|---|
variantTone. Border, surface, tile, and description all shift. | "default" | "info" | "success" | "warning" | "destructive" | "default" |
roleRoot landmark role. Override for status-like usage. | string | "alert" |
AlertIconTone-matched icon tile. Decorative, hidden from assistive tech. | Component | — |
AlertBodyTitle + description stack. | Component | — |
AlertTitleNeutral title, except destructive which alarms. | Component | — |
AlertDescriptionTone-tinted supporting text. | Component | — |
AlertActionEnd-pinned slot for buttons or dismiss controls. | Component | — |
classNameAdditional CSS classes on any part. | string | — |
Accessibility#
The root renders role='alert' by default, so additions announce to screen readers; pass role='status' for quieter updates. Icons are aria-hidden. Dismiss controls need their own aria-label, as the docs example shows.
Motion#
Alert is a static wrapper with no entrance, exit, or state animation; only child controls animate. It does not detect prefers-reduced-motion because there is no motion to suppress.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

