Components

Alert Dialog

A modal dialog that interrupts the user with important content and expects an explicit confirm-or-cancel response before proceeding.

Basic usage

Wrap a trigger and content. Radix manages the open state, focus trap, and dismissal for you.

Destructive action

For irreversible actions, open from a destructive button and restyle AlertDialogAction to reinforce the consequence.

Props

PropTypeDefaultDescription
openbooleanControlled open state of the dialog. Omit to let Radix manage it internally.
defaultOpenbooleanfalseOpen state when initially rendered, for uncontrolled usage.
onOpenChange(open: boolean) => voidCalled when the open state changes (trigger, cancel, action, or Escape).
AlertDialogTriggerReactNodeThe control that opens the dialog. Use asChild to render your own Button.
AlertDialogContentReactNodeThe modal panel. Renders in a portal with an overlay; must contain a Title.
AlertDialogActionReactNodeConfirming button styled with the default button variant; closes the dialog on click.
AlertDialogCancelReactNodeDismissing button styled as outline; receives initial focus and closes the dialog.
classNamestringAdditional Tailwind classes merged onto any sub-component.

Accessibility

  • Built on Radix Alert Dialog: the content is rendered with role="alertdialog" and focus is trapped inside while open.
  • AlertDialogTitle and AlertDialogDescription are wired to aria-labelledby and aria-describedby automatically — always include a Title.
  • Unlike a regular dialog, it does not close on overlay click or Escape-to-dismiss-only flows; Escape triggers Cancel so the user makes a deliberate choice.
  • The Cancel button receives initial focus, and focus returns to the trigger when the dialog closes.