Alert dialog
Asks you to confirm before continuing, usually before a delete.
Examples
Variants
Usage
Use it when
- An action removes, overwrites or sends something that cannot be taken back, and you must confirm first.
- Leaving a form would lose what was typed.
Use something else when
- The task has a form or more than one decision. Use Dialog instead.
- The action can be undone afterwards. Use Toaster with an undo action instead, and skip the question.
- The choice is between two equal paths, not a confirm. Use Dialog instead.
- The removal is one row in a menu that needs no confirm. Use a
variant="destructive"row in DropdownMenu instead.
Rules
General
Content
Avoid
Limits
Install
npx shadcn@latest add https://kaanarici.com/r/cobalt/alert-dialog.jsonimport { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogError, AlertDialogCancel, AlertDialogAction } from "@/components/cobalt/ui/alert-dialog"