Navigation: [/sitemap.md](/sitemap.md)

---
type: doc
title: Alert Dialog
description: A modal dialog for important confirmations that expects a response.
---

```astro live props={{ name: 'alert-dialog' }}
---
import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@/components/ui/alert-dialog"
---

<AlertDialog>
  <AlertDialogTrigger variant="outline">Show Dialog</AlertDialogTrigger>
  <AlertDialogContent>
    <AlertDialogHeader>
      <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
      <AlertDialogDescription>
        This action cannot be undone. This will permanently delete your account
        and remove your data from our servers.
      </AlertDialogDescription>
    </AlertDialogHeader>
    <AlertDialogFooter>
      <AlertDialogCancel>Cancel</AlertDialogCancel>
      <AlertDialogAction>Continue</AlertDialogAction>
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>
```

## Installation

```bash
npx shadcn@latest add @fulldev/alert-dialog
```

## Usage

```ts
import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@/components/ui/alert-dialog"
```

```astro
<AlertDialog>
  <AlertDialogTrigger variant="outline">Show Dialog</AlertDialogTrigger>
  <AlertDialogContent>
    <AlertDialogHeader>
      <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
      <AlertDialogDescription>
        This action cannot be undone. This will permanently delete your account
        and remove your data from our servers.
      </AlertDialogDescription>
    </AlertDialogHeader>
    <AlertDialogFooter>
      <AlertDialogCancel>Cancel</AlertDialogCancel>
      <AlertDialogAction>Continue</AlertDialogAction>
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>
```

## Composition

Use the following composition to build an `AlertDialog`:

```text
AlertDialog
├── AlertDialogTrigger
└── AlertDialogContent
    ├── AlertDialogHeader
    │   ├── AlertDialogMedia
    │   ├── AlertDialogTitle
    │   └── AlertDialogDescription
    └── AlertDialogFooter
        ├── AlertDialogCancel
        └── AlertDialogAction
```

## Notes

- Use `AlertDialog` for irreversible or high-risk actions, not routine inline
  confirmations.
- Keep `AlertDialogTitle` and `AlertDialogDescription` inside
  `AlertDialogContent` so screen readers announce the dialog context clearly.
- Pair the destructive path with `AlertDialogAction` and the safe path with
  `AlertDialogCancel`.
- Use `size="sm"` on `AlertDialogContent` for compact confirmations and
  `AlertDialogMedia` when the dialog needs an icon or visual cue.

## API Reference

See the [GitHub source code](https://github.com/fulldotdev/ui/tree/main/src/components/ui/alert-dialog) for more information on props.
See the [data-slot docs](https://github.com/bejamas/data-slot/blob/main/packages/alert-dialog/README.md) for more information on interactivity.
