npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-alert-dialog.json --yesAlert dialog
ProA modal that asks a person to confirm or cancel before an action that cannot be undone, such as a delete, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- AlertDialogTriggerWraps the control that opens the alert
- AlertDialogContentThe panel
- AlertDialogHeaderThe alert's top
- AlertDialogTitleThe question, which names the panel
- AlertDialogDescriptionWhat answering it does, which describes the panel
- AlertDialogBodyThe alert's middle, between AlertDialogHeader and AlertDialogFooter
- AlertDialogFooterThe row for the two answers, AlertDialogCancel and then the confirming one
- AlertDialogCancelThe answer that backs out and closes the alert
- AlertDialogActionThe confirming answer, last in the footer
- AlertDialogDestructiveActionThe confirming answer where confirming deletes or cannot be undone
import { AlertDialogBody, AlertDialogAction } from '@/components/ui/goop/alert-dialog';
import {
AlertDialog,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogDestructiveAction,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from '@/components/ui/goop/alert-dialog';
import { Button } from '@/components/ui/goop/button';
function DeleteRoute({ onDelete }: { onDelete: () => void }) {
return (
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">Delete route</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete the ridge path route?</AlertDialogTitle>
<AlertDialogDescription>Its 6 stops and 14 field notes are removed for the whole crew.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Keep it</AlertDialogCancel>
<AlertDialogDestructiveAction hold onConfirm={onDelete}>
Delete route
</AlertDialogDestructiveAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
}Press Delete on a list: the delete answer stays off until its name is typed exactly; Keep it or Escape leaves the list; a confirmed delete removes it from the list. Pick a look for a plain, a long or a title-only question. The lists live in the page only; picking a look brings them back.
When to use
- A modal that asks a person to confirm or cancel before an action that cannot be undone, such as a delete.
- Also called: confirm dialog or confirmation modal.
When not to use
- For a form use Dialog.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Alert dialog on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-alert-dialog.json --yesAdd the Goop Alert dialog to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { AlertDialogBody, AlertDialogAction } from '@/components/ui/goop/alert-dialog';
import {
AlertDialog,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogDestructiveAction,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from '@/components/ui/goop/alert-dialog';
import { Button } from '@/components/ui/goop/button';
function DeleteRoute({ onDelete }: { onDelete: () => void }) {
return (
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">Delete route</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete the ridge path route?</AlertDialogTitle>
<AlertDialogDescription>Its 6 stops and 14 field notes are removed for the whole crew.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Keep it</AlertDialogCancel>
<AlertDialogDestructiveAction hold onConfirm={onDelete}>
Delete route
</AlertDialogDestructiveAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
}- width, padding, gap: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| open? | boolean | |
| defaultOpen? | boolean | |
| onOpenChange? | (open: boolean) => void |
- Takes every prop of Dialog but modal (its page: dialog.md)
- State: open (open / defaultOpen / onOpenChange)
| Part | What it is |
|---|---|
| AlertDialogTrigger | Wraps the control that opens the alert; put the theme's Button inside with asChild; also takes asChild?: boolean |
| AlertDialogContent | The panel; put AlertDialogHeader in it, then AlertDialogBody when it holds a field, then AlertDialogFooter; also takes container?: HTMLElement | null |
| AlertDialogHeader | The alert's top; put AlertDialogTitle and AlertDialogDescription in it |
| AlertDialogTitle | The question, which names the panel |
| AlertDialogDescription | What answering it does, which describes the panel |
| AlertDialogBody | The alert's middle, between AlertDialogHeader and AlertDialogFooter |
| AlertDialogFooter | The row for the two answers, AlertDialogCancel and then the confirming one |
| AlertDialogCancel | The answer that backs out and closes the alert; it takes the focus as the alert opens; also takes type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean; loading?: boolean = false; loadingLabel?: string = 'Loading' |
| AlertDialogAction | The confirming answer, last in the footer; for a destructive one use AlertDialogDestructiveAction; also takes type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean; loading?: boolean = false; loadingLabel?: string = 'Loading' |
| AlertDialogDestructiveAction | The confirming answer where confirming deletes or cannot be undone; also takes type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean; icon?: IconName = 'alert-circle'; hold?: boolean = false; onConfirm?: () => void; onFinished?: () => void; holdDuration?: number; holdHint?: string = 'Hold to confirm'; confirmLabel?: string; confirmedLabel?: string = 'Confirmed'; loading?: boolean = false; loadingLabel?: string = 'Loading' |
- Required: AlertDialogTitle, inside AlertDialogContent
- data-slot values (to select a part by): alert-dialog-body, alert-dialog-content, alert-dialog-description, alert-dialog-footer, alert-dialog-header, alert-dialog-header-content, alert-dialog-title
Keyboard
| Key | What it does |
|---|---|
| Escape | Close |
| Tab | Move to the next button |
Accessibility
- The part itself answers the keys above.
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.