# Alert Dialog

A modal dialog that interrupts the user with important content and requires a response before continuing.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).





<ComponentThemeTabs>
  <ThemeTab name="mint">
    <PreviewWithCode name="alert-dialog">
      <AlertDialog>
        <AlertDialogTrigger>
          <Button variant="outline">Delete account</Button>
        </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>
    </PreviewWithCode>
  </ThemeTab>

  <ThemeTab name="berries">
    <PreviewWithCode name="alert-dialog">
      <AlertDialog>
        <AlertDialogTrigger>
          <Button variant="outline">Delete account</Button>
        </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>
    </PreviewWithCode>
  </ThemeTab>

  <ThemeTab name="citrine">
    <PreviewWithCode name="alert-dialog">
      <AlertDialog>
        <AlertDialogTrigger>
          <Button variant="outline">Delete account</Button>
        </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>
    </PreviewWithCode>
  </ThemeTab>

  <ThemeTab name="cinnamon">
    <PreviewWithCode name="alert-dialog">
      <AlertDialog>
        <AlertDialogTrigger>
          <Button variant="outline">Delete account</Button>
        </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>
    </PreviewWithCode>
  </ThemeTab>
</ComponentThemeTabs>

## Destructive Action [#destructive-action]

Use `AlertDialogAction` with `variant="destructive"` when confirming an irreversible operation.

<div className="my-6">
  <AlertDialog>
    <AlertDialogTrigger>
      <Button variant="destructive">
        Delete project
      </Button>
    </AlertDialogTrigger>

    <AlertDialogContent>
      <AlertDialogHeader>
        <AlertDialogTitle>
          Delete project?
        </AlertDialogTitle>

        <AlertDialogDescription>
          All files, deployments, and settings will be permanently removed.
          This action cannot be undone.
        </AlertDialogDescription>
      </AlertDialogHeader>

      <AlertDialogFooter>
        <AlertDialogCancel>
          Cancel
        </AlertDialogCancel>

        <AlertDialogAction className="bg-destructive text-white hover:bg-destructive/90">
          Delete
        </AlertDialogAction>
      </AlertDialogFooter>
    </AlertDialogContent>
  </AlertDialog>
</div>

## Props [#props]

### AlertDialog [#alertdialog]

| Prop           | Type                      | Default | Description                      |
| -------------- | ------------------------- | ------- | -------------------------------- |
| `open`         | `boolean`                 | —       | Controlled open state            |
| `defaultOpen`  | `boolean`                 | `false` | Initial open state               |
| `onOpenChange` | `(open: boolean) => void` | —       | Callback when open state changes |

### AlertDialogContent [#alertdialogcontent]

| Prop        | Type     | Default | Description            |
| ----------- | -------- | ------- | ---------------------- |
| `className` | `string` | —       | Additional CSS classes |

### AlertDialogAction / AlertDialogCancel [#alertdialogaction--alertdialogcancel]

| Prop        | Type      | Default | Description                    |
| ----------- | --------- | ------- | ------------------------------ |
| `className` | `string`  | —       | Override default button styles |
| `asChild`   | `boolean` | `false` | Render as child element        |

## Usage [#usage]

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

<AlertDialog>
  <AlertDialogTrigger asChild>
    <Button variant="outline">Open</Button>
  </AlertDialogTrigger>
  <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>
```

## Specs [#specs]

```md
# Mint — Alert Dialog Specs

## Component
- name: alert-dialog
- file: registry/mint/alert-dialog.tsx
- installs to: components/ui/alert-dialog.tsx
- dependencies: radix-ui
- registryDependencies: button

## What is it
A blocking modal dialog that requires the user to make an explicit choice before
continuing. Unlike Dialog, it cannot be dismissed by clicking the overlay or
pressing Escape — the user must click Cancel or Confirm. Use it exclusively for
destructive or irreversible actions: deleting data, leaving unsaved changes,
revoking access. Do not use it for informational content — use Dialog instead.

## Visual identity
Identical frame to Dialog: white background, generously rounded corners
(Mint's 1.25rem radius), a soft glassy border, and shadow-lg, centered on
screen with a semi-transparent overlay. Two-button footer with Cancel
(outline) on the left and Action (primary, Mint green) on the right. The
visual weight of the Action button signals the severity of the confirmation.

## Design tokens
--background: oklch(1 0 0)               — dialog background
--foreground: oklch(0.145 0 0)           — title text
--muted-foreground: oklch(0.52 0.06 155) — description text
--border: oklch(0.88 0.04 155 / 60%)     — dialog border
--primary: oklch(0.5 0.14 155)           — action button background
--primary-foreground: oklch(1 0 0)       — action button text
--destructive: oklch(0.55 0.25 15)       — destructive action override
--radius: 1.25rem                        — rounded-lg

## Dark theme
--background: oklch(0.145 0 0)
--foreground: oklch(0.985 0 0)
--muted-foreground: oklch(0.6 0.06 155)
--border: oklch(0.32 0.05 155 / 40%)

## shadcn config (components.json)
- style: new-york
- rsc: true
- tsx: true
- baseColor: neutral
- cssVariables: true
- iconLibrary: lucide
- aliases:
  - components → @/components
  - ui → @/components/ui
  - utils → @/lib/utils
  - lib → @/lib
  - hooks → @/hooks

## Sub-components
- AlertDialogTrigger  → opens the dialog
- AlertDialogContent  → the modal panel (includes portal + overlay)
- AlertDialogHeader   → wraps title + description
- AlertDialogFooter   → wraps Cancel + Action buttons
- AlertDialogTitle    → required — describes what is being confirmed
- AlertDialogDescription → required — explains the consequences
- AlertDialogAction   → confirm button, styled as primary by default
- AlertDialogCancel   → dismiss button, styled as outline by default

## States
- closed:   dialog not mounted in DOM
- open:     fade-in + zoom-in-95 animation, overlay fades in
- closing:  fade-out + zoom-out-95 animation
- overlay:  bg-black/50, blocks interaction with page content

## Conventions
- Always include both AlertDialogTitle and AlertDialogDescription
- AlertDialogDescription must explain the consequences, not just ask for confirmation
- For destructive confirms: add className="bg-destructive text-white hover:bg-destructive/90" to AlertDialogAction
- Never use Alert Dialog for non-destructive confirmations — use Dialog instead
- Always use AlertDialogTrigger asChild with your own Button component
- Footer order: Cancel left, Action right (matches platform conventions)
```

## Installation [#installation]

<CommandBox componentName="alert-dialog" className="mt-2" />
