Alert Dialog
A modal confirmation dialog that interrupts the user with important content and expects a response, typically for destructive actions.
Preview
Usage
tsx
import {
AlertDialog,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogAction,
AlertDialogCancel,
} from "zostel-ui";
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="destructive">Cancel Booking</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Cancel Booking?</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. Your booking will
be permanently cancelled.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Keep Booking</AlertDialogCancel>
<AlertDialogAction>Yes, Cancel</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>Props
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | — | Controlled open state of the alert dialog |
onOpenChange | (open: boolean) => void | — | Callback when the open state changes |
openType:
booleanDefault: —
Controlled open state of the alert dialog
onOpenChangeType:
(open: boolean) => voidDefault: —
Callback when the open state changes