AlertDialog

Confirmation dialog requiring explicit user action; no light-dismiss

Category: overlay · WCAG 2.2-AA · overlay, dialog, confirm, destructive

Variants

States

Props

PropTypeDefaultDescription
openbooleanWhether the component is open (controlled).
titlestringTitle text for the component.
descriptionstringSupporting description text.
onConfirm() => voidCalled when the confirm button is activated.
onCancel() => voidCalled when the cancel button is activated.
labelsAlertDialogLabelsOverrides for the component’s user-visible strings (i18n).
variant'destructive' | 'default'defaultSelects the visual style variant.

Design tokens

When to use

When not to use

How to build an accessible AlertDialog in React →

Examples

Destructive confirm

<AlertDialog
  open={isOpen}
  variant="destructive"
  title="Delete project?"
  description="This permanently removes the project and cannot be undone."
  onConfirm={remove}
  onCancel={() => setIsOpen(false)}
/>

Custom action labels

<AlertDialog
  open={isOpen}
  title="Sign out?"
  description="Unsaved changes will be lost."
  labels={{ confirm: 'Sign out', cancel: 'Stay' }}
  onConfirm={signOut}
  onCancel={() => setIsOpen(false)}
/>

Related components

← Back to docs