Skip to Content
Columbus

Alert Dialog

A modal dialog that interrupts the user workflow for critical confirmations.

Installation

pnpm dlx shadcn@latest add @columbus/alert-dialog

Usage

import {
  AlertDialog,
  AlertDialogClose,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogPopup,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@/components/ui/alert-dialog";

<AlertDialog>
  <AlertDialogTrigger render={<Button variant="destructive-outline" />}>
    Delete
  </AlertDialogTrigger>
  <AlertDialogPopup>
    <AlertDialogHeader>
      <AlertDialogTitle>Delete this file?</AlertDialogTitle>
      <AlertDialogDescription>This can't be undone.</AlertDialogDescription>
    </AlertDialogHeader>
    <AlertDialogFooter>
      <AlertDialogClose render={<Button variant="ghost" />}>
        Cancel
      </AlertDialogClose>
      <AlertDialogClose render={<Button variant="destructive" />}>
        Delete
      </AlertDialogClose>
    </AlertDialogFooter>
  </AlertDialogPopup>
</AlertDialog>;

Unlike Dialog, an alert dialog doesn't close when you click outside it, and it has no close button in the corner. People must pick one of the actions, or press Escape.

variant="bare" removes the footer's border and background.

API reference

Built on Base UI Alert Dialog. Every part accepts the props of its Base UI counterpart. AlertDialogPopup is also exported as AlertDialogContent.

AlertDialogPopup

Prop

Type

AlertDialogFooter

Prop

Type

On this page