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

open
Type: boolean
Default:

Controlled open state of the alert dialog

onOpenChange
Type: (open: boolean) => void
Default:

Callback when the open state changes