Alert
Callout banner for important messages, composed with AlertTitle and
AlertDescription.
Lay out as a two-column grid: a direct-child <svg> is auto-detected and
given its own icon column, otherwise the text spans full width. Renders
role="alert" so screen readers announce it; tone="danger" recolours the
text and description for error states.
Usage
import { Alert, alertAnatomy, AlertDescription, AlertTitle } from "@desk/ui/components/alert";Best practices
Use
Alertfor a persistent inline message block; a transient, auto-dismissing notification is a toast (Toaster/sonner).Compose
AlertTitle/AlertDescriptionas children and render a direct-child<svg>for the auto-detected icon column;tone="danger"recolours for errors.It renders
role="alert", so AT announces it on mount — keep it a notice, not a container for heavy interactive UI.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| tone | "neutral" | "danger" | null | undefined |
Also exports
- const
alertAnatomy - component
AlertDescription - component
AlertTitle
Anatomy
Alert
alertDisplays a callout for important information
AlertIcon
alert-iconLeading icon
AlertTitle
alert-titleAlert heading
AlertDescription
alert-descriptionAlert body text