Toggle Sidebar B
AppearanceLight & dark mode D

Alert Dialog

A modal dialog that interrupts the user with important content and expects a response.

Demo

Replay preview

Basic

Replay preview

Small

Set size="sm" on AlertDialogContent for a compact dialog.

Replay preview

Media

AlertDialogMedia renders an icon or image alongside the header.

Replay preview

Small with Media

Replay preview

Destructive

Pass variant to AlertDialogAction and AlertDialogCancel for destructive confirmations.

Replay preview

API Reference

AlertDialogContent

PropTypeDefaultDescription
size"default" | "sm""default"Dialog size. sm centers content and stacks the footer in a 2-col grid.

AlertDialogAction / AlertDialogCancel

PropTypeDefaultDescription
variantButtonVariants["variant"]default / "outline"Button style, e.g. destructive.
sizeButtonVariants["size"]"default"Button size.

AlertDialogMedia

PropTypeDefaultDescription
classstringContainer for an icon or image in the header.

Accessibility

Keyboard shortcuts and ARIA behavior.

Shortcut Description
EscCloses the dialog (returns focus to the trigger).
TabFocus is trapped inside the dialog while open.
  • Unlike Dialog, clicking outside does not close an alert dialog; the user must choose an action.