ui
Dialog
A modal dialog that overlays the screen with content and requires user interaction.
1. Import
Import the dialog components from the design system.
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/design-system/components/ui/dialog"2. Props
Dialog component props.
| Prop | Type | Default |
|---|---|---|
| open | boolean | -- |
| onOpenChange | (open: boolean) => void | -- |
| className | string | -- |
3. Usages
Common dialog patterns and configurations.
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/design-system/components/ui/dialog";
import { Button } from "@/design-system/components/ui/button";
import { Input } from "@/design-system/components/ui/input";
import { Label } from "@/design-system/components/ui/label";
export function Example() {
return (
<Dialog>
<DialogTrigger render={<Button variant="outline">Edit Profile</Button>} />
<DialogContent className="sm:max-w-[425px]">
<DialogHeader>
<DialogTitle>Edit profile</DialogTitle>
<DialogDescription>
Make changes to your profile here. Click save when you're done.
</DialogDescription>
</DialogHeader>
<div className="grid gap-4 py-4">
<div className="grid grid-cols-4 items-center gap-4">
<Label htmlFor="name" className="text-right">Name</Label>
<Input id="name" defaultValue="Pedro Duarte" className="col-span-3" />
</div>
</div>
<DialogFooter>
<Button type="submit">Save changes</Button>
</DialogFooter>
</DialogContent>
</Dialog>
);
}