Alert Dialog

A modal dialog that interrupts the user with important content and expects a response. Unlike a regular dialog, an alert dialog requires explicit acknowledgement before it can be dismissed.

Examples

Basic

Destructive

Overview

AlertDialog is a focused confirmation modal. It blocks backdrop dismissal and Escape — the user must pick one of the actions. Use it for irreversible operations like deletes and account changes; for general modals use Dialog.

tsx
import {
  AlertDialog,
  AlertDialogTrigger,
  AlertDialogContent,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogCancel,
  AlertDialogAction,
} from "@rogo-technologies/ui/alert-dialog";

<AlertDialog>
  <AlertDialogTrigger>Delete project</AlertDialogTrigger>
  <AlertDialogContent>
    <AlertDialogHeader>
      <AlertDialogTitle>Are you sure?</AlertDialogTitle>
      <AlertDialogDescription>This action can't be undone.</AlertDialogDescription>
    </AlertDialogHeader>
    <AlertDialogFooter>
      <AlertDialogCancel>Cancel</AlertDialogCancel>
      <AlertDialogAction>Continue</AlertDialogAction>
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>;

Usage

Destructive action

Pass variant="destructive" to AlertDialogAction for irreversible operations.

tsx
<AlertDialogAction variant="destructive" onClick={handleDelete}>
  Delete project
</AlertDialogAction>

Controlled

Control the dialog programmatically with open and onOpenChange.

tsx
const [open, setOpen] = useState(false);

<AlertDialog open={open} onOpenChange={setOpen}>
  <AlertDialogContent>
    <AlertDialogHeader>
      <AlertDialogTitle>Confirm</AlertDialogTitle>
      <AlertDialogDescription>Are you sure?</AlertDialogDescription>
    </AlertDialogHeader>
    <AlertDialogFooter>
      <AlertDialogCancel>Cancel</AlertDialogCancel>
      <AlertDialogAction onClick={handleConfirm}>Confirm</AlertDialogAction>
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>;

Alert Dialog vs Dialog

FeatureDialogAlert Dialog
Backdrop clickCloses dialogRequires explicit action
Escape keyCloses dialogRequires explicit action
Use caseForms, settings, contentConfirmations, warnings, destructive actions

API

AlertDialog (Root)

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

Subcomponents

ComponentPurpose
AlertDialogTriggerButton that opens the alert dialog.
AlertDialogContentThe popup container, including backdrop and portal.
AlertDialogHeaderTop section wrapper for title + description.
AlertDialogTitleRequired heading announced by screen readers.
AlertDialogDescriptionSupporting copy below the title.
AlertDialogFooterBottom action row.
AlertDialogCancelCancel button that closes without confirming.
AlertDialogActionConfirm button. Accepts variant="destructive" for danger flows.

Guidelines

Do

  • Use AlertDialog for irreversible operations (delete, archive, sign out)
  • Always provide an AlertDialogTitle and AlertDialogDescription
  • Label actions with the verb of the operation ("Delete project", not "OK")
  • Use variant="destructive" on the action when the operation can't be undone

Don't

  • Don't use AlertDialog for routine confirmations the user does dozens of times — it becomes noise
  • Don't pre-select the destructive action as the default focus
  • Don't write vague titles like "Confirm" — say what's about to happen
  • Don't use it for general forms or settings — use Dialog instead
PreviousAccordion
NextAvatar
Made in NYC© 2026 Rogo Technologies Inc.