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
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | — | Controlled open state of the dialog |
onOpenChange | (open: boolean) => void | — | Callback when the open state changes |
modal | boolean | true | Whether the dialog is modal (blocks interaction with the rest of the page) |
openType:
booleanDefault: —
Controlled open state of the dialog
onOpenChangeType:
(open: boolean) => voidDefault: —
Callback when the open state changes
modalType:
booleanDefault: true
Whether the dialog is modal (blocks interaction with the rest of the page)