---
title: "Alert Dialog"
description: "A modal dialog that asks the user to confirm an important action, such as a delete. Built on Base UI with focus trapping and an accessible title."
plan: Free
docs: https://ui.edbn.me/docs/components/alert-dialog
---

# Alert Dialog

A modal dialog that asks the user to confirm an important action, such as a delete. Built on Base UI with focus trapping and an accessible title.

## Installation

```bash
npx shadcn@4.19.0 add https://ui.edbn.me/r/alert-dialog.json
```

## Dependencies
- npm: @base-ui/react@^1.8.0
- edbn: edbn-base, button

## Usage

```tsx examples/alert-dialog-basic.tsx
"use client";
import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";

export default function AlertDialogBasicPreview() {
  return (
    <AlertDialog>
      <AlertDialogTrigger render={<Button variant="destructive" />}>
        Delete project
      </AlertDialogTrigger>
      <AlertDialogContent>
        <AlertDialogHeader>
          <AlertDialogTitle>Delete this project?</AlertDialogTitle>
          <AlertDialogDescription>
            This action cannot be undone.
          </AlertDialogDescription>
        </AlertDialogHeader>
        <AlertDialogFooter>
          <AlertDialogCancel>Cancel</AlertDialogCancel>
          <AlertDialogAction variant="destructive">Delete</AlertDialogAction>
        </AlertDialogFooter>
      </AlertDialogContent>
    </AlertDialog>
  );
}
```

## Files
- components/ui/alert-dialog.tsx (198 lines)

## For agents
- Base theme, once per project: npx shadcn@4.19.0 add https://ui.edbn.me/r/edbn-base.json
- MCP server with search, items, examples and source: https://ui.edbn.me/mcp
- Every page and item: https://ui.edbn.me/llms.txt
