Dialog

A modal dialog window that overlays the main content, requiring user interaction before returning to the parent view.

Preview

Usage

tsx
import {
  Dialog,
  DialogTrigger,
  DialogContent,
  DialogHeader,
  DialogTitle,
  DialogDescription,
  DialogFooter,
  DialogClose,
} from "zostel-ui";

<Dialog>
  <DialogTrigger asChild>
    <Button>Open Dialog</Button>
  </DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Edit Profile</DialogTitle>
      <DialogDescription>
        Make changes to your profile here.
      </DialogDescription>
    </DialogHeader>
    <div className="space-y-4">
      <Input label="Name" defaultValue="Traveller" />
      <Input label="Email" defaultValue="traveller@zostel.com" />
    </div>
    <DialogFooter>
      <DialogClose asChild>
        <Button variant="outline">Cancel</Button>
      </DialogClose>
      <Button>Save Changes</Button>
    </DialogFooter>
  </DialogContent>
</Dialog>

Props

open
Type: boolean
Default:

Controlled open state of the dialog

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

Callback when the open state changes

modal
Type: boolean
Default: true

Whether the dialog is modal (blocks interaction with the rest of the page)