Components
A modal dialog that interrupts the user with important content and expects a response.
Playground
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@workspace/ui/components/alert-dialog"
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">Show dialog</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete your
account and remove your data from our servers.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Continue</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>size="sm" on AlertDialogContent keeps the compact width on every viewport, centers the text, and turns the footer into a two-column grid — the OS-prompt pattern for short confirmations.<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">Show dialog</Button>
</AlertDialogTrigger>
<AlertDialogContent size="sm">
<AlertDialogHeader>
<AlertDialogTitle>Allow accessory to connect?</AlertDialogTitle>
<AlertDialogDescription>
Do you want to allow the USB accessory to connect to this device?
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Don't allow</AlertDialogCancel>
<AlertDialogAction>Allow</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>size-8 automatically.import { ShareNetworkIcon } from "@phosphor-icons/react"
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">Share project</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogMedia>
<ShareNetworkIcon />
</AlertDialogMedia>
<AlertDialogTitle>Share this project?</AlertDialogTitle>
<AlertDialogDescription>
Anyone with the link will be able to view and edit this project.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Share</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>size="sm" with AlertDialogMedia stacks the icon above the centered text — matching native permission prompts.import { BluetoothIcon } from "@phosphor-icons/react"
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">Show dialog</Button>
</AlertDialogTrigger>
<AlertDialogContent size="sm">
<AlertDialogHeader>
<AlertDialogMedia>
<BluetoothIcon />
</AlertDialogMedia>
<AlertDialogTitle>Allow accessory to connect?</AlertDialogTitle>
<AlertDialogDescription>
Do you want to allow the USB accessory to connect to this device?
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Don't allow</AlertDialogCancel>
<AlertDialogAction>Allow</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>variant prop. Pair a destructive action with a tinted AlertDialogMedia to signal irreversible operations.import { TrashIcon } from "@phosphor-icons/react"
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="destructive">Delete chat</Button>
</AlertDialogTrigger>
<AlertDialogContent size="sm">
<AlertDialogHeader>
<AlertDialogMedia className="bg-destructive/10 text-destructive dark:bg-destructive/20">
<TrashIcon />
</AlertDialogMedia>
<AlertDialogTitle>Delete chat?</AlertDialogTitle>
<AlertDialogDescription>
This will permanently delete this chat conversation and any
memories saved during this chat.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction variant="destructive">Delete</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>start-1/2), so passing dir="rtl" mirrors the layout — including the footer order — without extra classes.<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">إظهار الحوار</Button>
</AlertDialogTrigger>
<AlertDialogContent dir="rtl">
<AlertDialogHeader>
<AlertDialogTitle>هل أنت متأكد تمامًا؟</AlertDialogTitle>
<AlertDialogDescription>
لا يمكن التراجع عن هذا الإجراء. سيؤدي هذا إلى حذف حسابك نهائيًا من
خوادمنا.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>إلغاء</AlertDialogCancel>
<AlertDialogAction>متابعة</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>role="alertdialog", focus moves to the least destructive action (AlertDialogCancel) on open, and Escape closes while overlay clicks are ignored — interruption is the point. AlertDialogTitle labels the dialog via aria-labelledby and is required; AlertDialogDescription wires up aria-describedby. Reserve the component for confirmations that block the task — for everything else, use Dialog.<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Discard draft?</AlertDialogTitle>
<AlertDialogDescription>
Your changes will be lost. This cannot be undone.
</AlertDialogDescription>
</AlertDialogHeader>
{/* Cancel receives initial focus — the safe default */}
<AlertDialogFooter>
<AlertDialogCancel>Keep editing</AlertDialogCancel>
<AlertDialogAction variant="destructive">Discard</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>asChild to keep your own markup), AlertDialogPortal and AlertDialogOverlay handled automatically by AlertDialogContent, the AlertDialogHeader / AlertDialogMedia / AlertDialogTitle / AlertDialogDescription / AlertDialogFooter layout parts, and AlertDialogCancel / AlertDialogAction as ready-made Buttons. All accept their underlying element props.| Component | Prop | Default |
|---|---|---|
| AlertDialog | open?: boolean, onOpenChange?: (open: boolean) => void | — |
| AlertDialogContent | size?: "default" | "sm" | "default" |
| AlertDialogAction | variant?: Button variant, size?: Button size | "default" |
| AlertDialogCancel | variant?: Button variant, size?: Button size | "outline" |
| AlertDialogTrigger | asChild?: boolean | false |
<AlertDialog data-slot="alert-dialog" /> <AlertDialogTrigger data-slot="alert-dialog-trigger" /> <AlertDialogContent data-slot="alert-dialog-content" data-size data-open data-closed /> <AlertDialogOverlay data-slot="alert-dialog-overlay" /> <AlertDialogHeader data-slot="alert-dialog-header" /> <AlertDialogMedia data-slot="alert-dialog-media" /> <AlertDialogTitle data-slot="alert-dialog-title" /> <AlertDialogDescription data-slot="alert-dialog-description" /> <AlertDialogFooter data-slot="alert-dialog-footer" /> <AlertDialogAction data-slot="alert-dialog-action" /> <AlertDialogCancel data-slot="alert-dialog-cancel" />
Tokens used
12 design tokens consumed by the Alert Dialog component.
--popover
Popover
--popover-foreground
Popover Foreground
--foreground
Foreground
--muted
Muted
--muted-foreground
Muted Foreground
--font-heading
GT Alpina Condensed
--text-lg
Text Large (18px)
--text-sm
Text Small (14px)
--font-weight-medium
Font weight Medium (500)
--radius-xl
Radius 1.4× (14px)
--radius-md
Radius 0.8× (8px)
--spacing
Spacing unit (4px)