# AlertDialog _(no submodules)_ - alert-dialog.variants — `alertDialogOverlayVariants… - [alert-dialog.variants](./alert-dialog.variants.md) — `alertDialogOverlayVariants`, `alertDialogContentVariants`, `alertDialogHeaderVariants`, `alertDialogFooterVariants`, `… - alert-dialog.variants — `alertDialogOverlayVariants… - [alert-dialog.variants](./alert-dialog.variants.md) — `alertDialogOverlayVariants`, `alertDialogContentVariants`, `alertDialogHeaderVariants`, `alertDialogFooterVariants`, `… - alert-dialog.variants — `alertDialogOverlayVariants… - [alert-dialog.variants](./alert-dialog.variants.md) — `alertDialogOverlayVariants`, `alertDialogContentVariants`, `alertDialogHeaderVariants`, `alertDialogFooterVariants`, `… - alert-dialog.variants — `alertDialogOverlayVariants… - [alert-dialog.variants](./alert-dialog.variants.md) — `alertDialogOverlayVariants`, `alertDialogContentVariants`, `alertDialogHeaderVariants`, `alertDialogFooterVariants`, `… - [alert-dialog.variants](./alert-dialog.variants.md) — `alertDialogOverlayVariants`, `alertDialogContentVariants`, `alertDialogHeaderVariants`, `alertDialogFooterVariants`, `… ## Purpose `` and its sub-components (``, ``, ``, ``, ``, ``, ``, ``, ``, ``) are the chassis modal CONFIRMATION dialog primitives built on `@radix-ui/react-alert-dialog`. The structural difference between `` and `` is the click-outside-suppression: an alert dialog CANNOT be dismissed by clicking the overlay backdrop — the user MUST press the `` or `` button. Use `` for destructive operations (delete / discard / log out) where an accidental backdrop click could lose work; use `` for everything else. Per the WAI-ARIA alertdialog pattern, every alert dialog MUST contain an `` so the accessible name is announced. Use `className="sr-only"` if the visible UI does not need a heading. Radix renders `role="alertdialog"` (NOT `role="dialog"`) so screen readers know to announce the prompt as a high-priority interrupt. ## Features - `role="alertdialog"` (Radix-managed) so screen readers announce a high-priority prompt. - Click-outside dismissal SUPPRESSED — only Action / Cancel resolve the dialog. - Escape closes (treated as cancel) — Radix-managed. - Focus-trap on open; restore-focus to the trigger on close. - Four content sizes (`sm`, `default`, `lg`, `xl`) scale the panel max-width. - `` defaults to Button `variant="default"` styling (primary). - `` defaults to Button `variant="outline"` styling (secondary). - Theme-driven cva overrides for every slot via `useThemedVariants("AlertDialog")`. - All sub-components forward refs. - `motion-reduce:animate-none` collapses animations under `prefers-reduced-motion: reduce`. ## Usage: Basic Example ```tsx import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@suaveplan/react-ui"; export function ConfirmDelete() { return ( Delete account Are you sure? This action cannot be undone. Cancel Delete ); } ``` ## Usage: Advanced Example ```tsx import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@suaveplan/react-ui"; import { useState } from "react"; export function ConfirmDestructive({ title, description, onConfirm, }: { readonly title: string; readonly description: string; readonly onConfirm: () => Promise; }) { const [open, setOpen] = useState(false); const [busy, setBusy] = useState(false); async function handleConfirm() { setBusy(true); try { await onConfirm(); setOpen(false); } finally { setBusy(false); } } return ( {title} {description} Cancel {busy ? "Working…" : "Confirm"} ); } ``` ## API Reference ### `` Wraps the Radix AlertDialog Root. Same lifecycle props as `` (`open`, `defaultOpen`, `onOpenChange`). ### `` | Prop | Type | Default | Description | |---|---|---|---| | `size` | `"sm" \| "default" \| "lg" \| "xl"` | `"default"` | Visual variant scaling the panel max-width. | ### `` REQUIRED for accessibility. Render `className="sr-only"` if no visible heading is needed. ### ``, `` Renders as buttons with the default Button `variant="default"` and `variant="outline"` styling respectively. Activating either resolves the dialog (closes it). ### ``, ``, ``, ``, ``, `` Direct re-exports of the Radix sub-components with the chassis cva applied. ## Implementation Notes - The chassis NEVER assigns a numeric `z-index` — Radix portals handle stacking. - The Action / Cancel button cva is INLINED into AlertDialog rather than reusing `