Alert Dialog

A modal dialog that interrupts the user to confirm a consequential action. Unlike a plain Dialog, it does not dismiss on backdrop click — the user must choose AlertDialogAction or AlertDialogCancel (Esc also cancels).

Compose AlertDialogTrigger + AlertDialogContent (with AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, and the AlertDialogAction / AlertDialogCancel buttons). Open state can be controlled (open + onOpenChange) or uncontrolled.

Props

AlertDialog

PropTypeDefaultDescription
openbooleanControlled open state. Omit for uncontrolled.
defaultOpenbooleanfalseInitial state when uncontrolled.
onOpenChange(open: boolean) => voidFired when open state changes.

AlertDialogTrigger, AlertDialogAction, and AlertDialogCancel each accept asChild to render your own button. Action/Cancel close the dialog after their onClick runs (call preventDefault() to keep it open).