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/bearnie/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

With Icon

Add an icon to the title for visual emphasis.

With Custom Content

Add lists, inputs, or any custom content to the description area.

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

PropTypeDefaultDescription
variant'default' | 'destructive''default'The visual style of the action button

AlertDialogCancel

Styled as an outline button. Override styles using the class prop.

Dependencies

This component uses the Button component internally. Make sure to install it.