Alert Dialog
Interrupting confirmation for destructive actions.
Installation
npm install @aspyn-io/kit @aspyn-io/tokensimport {
AlertDialog,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogCancel,
AlertDialogAction,
} from "@aspyn-io/kit";Destructive confirmation
Unlike Dialog, AlertDialog interrupts: no outside-click dismissal, and Cancel receives initial focus. Use it when data loss is on the line.
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="destructive">Delete account</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogDescription>
This permanently deletes the account and all associated data.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction className={buttonVariants({ variant: "destructive" })}>
Delete account
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>Notes
- Dialog closes on overlay click; AlertDialog deliberately does not.
- AlertDialogAction/Cancel are pre-styled as buttons — pass buttonVariants() to restyle.