bearnie

Alert Dialog

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

Installation

npx bearnie add alert-dialog
npx bearnie add alert-dialog

Usage

import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogOverlay,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog"
<AlertDialog>
<AlertDialogTrigger>
  <Button>Open</Button>
</AlertDialogTrigger>
<AlertDialogOverlay />
<AlertDialogContent>
  <AlertDialogHeader>
    <AlertDialogTitle>Are you sure?</AlertDialogTitle>
    <AlertDialogDescription>
      This action cannot be undone.
    </AlertDialogDescription>
  </AlertDialogHeader>
  <AlertDialogFooter>
    <AlertDialogCancel>Cancel</AlertDialogCancel>
    <AlertDialogAction>Continue</AlertDialogAction>
  </AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>

Examples

Destructive action

Difference from Dialog

Alert Dialog is specifically designed for confirmation actions:

  • No close on overlay click - Users must explicitly choose an action
  • Cancel button included - Always provides a way to dismiss
  • Focused interaction - Emphasizes the confirm/cancel pattern
  • Uses role="alertdialog" - Proper accessibility semantics

Use Alert Dialog when you need user confirmation before a destructive or important action.

Props

All Alert Dialog components accept class for additional CSS classes.

AlertDialogAction / AlertDialogCancel

These are styled buttons. Override styles using the class prop.