Components
Displays a callout for user attention.
Playground
Alert with AlertTitle and AlertDescription. Drop an svg as the first child and the grid places it beside the text automatically — the container carries role="alert" for assistive technology.import {
Alert,
AlertDescription,
AlertTitle,
} from "@workspace/ui/components/alert"
import { CheckCircleIcon } from "@phosphor-icons/react"
<Alert>
<CheckCircleIcon />
<AlertTitle>Success! Your changes have been saved.</AlertTitle>
<AlertDescription>
This is an alert with icon, title and description.
</AlertDescription>
</Alert>AlertTitle makes a compact one-liner, with or without the icon.<Alert>
<InfoIcon />
<AlertTitle>
This alert has a title and an icon. No description.
</AlertTitle>
</Alert>
<Alert>
<AlertTitle>This alert has a title and nothing else.</AlertTitle>
</Alert>variant="destructive" tints the icon and title with --destructive and softens the description to 90% opacity — the surface stays on bg-card so the message reads without shouting.Please verify your billing information and try again.
import { WarningCircleIcon } from "@phosphor-icons/react"
<Alert variant="destructive">
<WarningCircleIcon />
<AlertTitle>Unable to process your payment.</AlertTitle>
<AlertDescription>
<p>Please verify your billing information and try again.</p>
<ul className="list-inside list-disc">
<li>Check your card details</li>
<li>Ensure sufficient funds</li>
<li>Verify billing address</li>
</ul>
</AlertDescription>
</Alert>AlertAction pins its content to the top end corner and the alert reserves space for it automatically — use it for a dismiss button or a short follow-up action.import { AlertAction } from "@workspace/ui/components/alert"
import { Button } from "@workspace/ui/components/button"
<Alert>
<CheckCircleIcon />
<AlertTitle>Your message has been sent.</AlertTitle>
<AlertDescription>
Recipients should receive it within a few minutes.
</AlertDescription>
<AlertAction>
<Button variant="outline" size="sm">
Undo
</Button>
</AlertAction>
</Alert>data-slot selector and give everything its dark: counterpart.import { GiftIcon } from "@phosphor-icons/react"
<Alert className="border-green-200 bg-green-100 text-green-700 *:data-[slot=alert-description]:text-green-700/90 dark:border-green-900 dark:bg-green-950 dark:text-green-300 dark:*:data-[slot=alert-description]:text-green-300/90">
<GiftIcon />
<AlertTitle>Gift card applied</AlertTitle>
<AlertDescription>
Your balance covers the full order — nothing to pay today.
</AlertDescription>
</Alert>
<Alert className="border-orange-200 bg-orange-100 text-orange-700 *:data-[slot=alert-description]:text-orange-700/90 dark:border-orange-900 dark:bg-orange-950 dark:text-orange-300 dark:*:data-[slot=alert-description]:text-orange-300/90">
<WarningCircleIcon />
<AlertTitle>Scheduled maintenance</AlertTitle>
<AlertDescription>
The dashboard will be read-only on Saturday from 02:00 to 04:00.
</AlertDescription>
</Alert>dir="rtl" on a wrapper or inherit it from a Direction provider — the layout uses logical properties throughout, so the icon column, text alignment and the AlertAction corner all flip automatically.<div dir="rtl">
<Alert>
<CheckCircleIcon />
<AlertTitle>تم حفظ التغييرات بنجاح.</AlertTitle>
<AlertDescription>هذا تنبيه مع أيقونة وعنوان ووصف.</AlertDescription>
<AlertAction>
<Button variant="outline" size="sm">
تراجع
</Button>
</AlertAction>
</Alert>
</div>div and accepts all div props — only Alert adds a prop of its own, plus role="alert" so screen readers announce it.| Prop | Type | Default |
|---|---|---|
| Alert variant | "default" | "destructive" | "default" |
| className (all parts) | string | — |
Tokens used
9 design tokens consumed by the Alert component.
--card
Card
--card-foreground
Card Foreground
--destructive
Destructive
--muted-foreground
Muted Foreground
--foreground
Foreground
--border
Border
--radius-lg
Radius 1× (10px)
--text-sm
Text Small (14px)
--spacing
Spacing unit (4px)