ThiloDesign System
DV

Alert Dialog

shadcn/ui

Interrupts the user with a mandatory choice. No way to dismiss without clicking Cancel or the action button.

@/components/ui/alert-dialog

Default — confirm action

Default: AlertDialogAction uses bg-primary — for reversible or safe confirmations

Destructive — irreversible action

Destructive: override action with className="bg-destructive text-destructive-foreground hover:bg-destructive/90"

In context — bulk delete

Include the count and IDs in the description so the user can verify before confirming

AlertDialog vs Dialog

AlertDialogDialog
Close on backdropNo — user must choose an actionYes — click outside closes
Escape keyBlocked — no escapeYes — closes dialog
X buttonNoYes
Best forDelete, logout, data loss, bulk actionsForms, detail views, settings

Sub-components

ComponentRole
AlertDialogRoot — manages open/closed state
AlertDialogTriggerOpens the dialog — use asChild with your own Button
AlertDialogContentModal panel — centered, no outside-click or Escape to dismiss
AlertDialogHeaderContainer for title + description
AlertDialogTitleBold heading — what will happen
AlertDialogDescriptionConsequences and details
AlertDialogFooterContainer for Cancel + Action buttons
AlertDialogCancelDismiss without action — renders as outline Button
AlertDialogActionConfirm the action — bg-primary by default; override for destructive

On this page