Copy to clipboard
Dialog Title
This is a dialog description.
<Dialog>
<DialogTrigger>
<Button>Open Dialog</Button>
</DialogTrigger>
<DialogOverlay />
<DialogContent>
<DialogHeader>
<DialogTitle>Dialog Title</DialogTitle>
<DialogDescription>This is a dialog description.</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button variant="outline">Cancel</Button>
<Button>Continue</Button>
</DialogFooter>
</DialogContent>
</Dialog>
<Dialog>
<DialogTrigger>
<Button>Open Dialog</Button>
</DialogTrigger>
<DialogOverlay />
<DialogContent>
<DialogHeader>
<DialogTitle>Dialog Title</DialogTitle>
<DialogDescription>This is a dialog description.</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button variant="outline">Cancel</Button>
<Button>Continue</Button>
</DialogFooter>
</DialogContent>
</Dialog> <Dialog>
<DialogTrigger>
<Button>Open Dialog</Button>
</DialogTrigger>
<DialogOverlay />
<DialogContent>
<DialogHeader>
<DialogTitle>Dialog Title</DialogTitle>
<DialogDescription>This is a dialog description.</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button variant="outline">Cancel</Button>
<Button>Continue</Button>
</DialogFooter>
</DialogContent>
</Dialog>
Installation
Copy to clipboard
npx bearnie add dialog
npx bearnie add dialog npx bearnie add dialog
bunx bearnie add dialog
bunx bearnie add dialog bunx bearnie add dialog
pnpm dlx bearnie add dialog
pnpm dlx bearnie add dialog pnpm dlx bearnie add dialog
yarn dlx bearnie add dialog
yarn dlx bearnie add dialog yarn dlx bearnie add dialog
Usage
import {
Dialog,
DialogTrigger,
DialogOverlay,
DialogContent,
DialogHeader,
DialogTitle,
DialogDescription,
DialogFooter,
} from "@/components/bearnie/dialog"<Dialog>
<DialogTrigger>
<Button>Open</Button>
</DialogTrigger>
<DialogOverlay />
<DialogContent>
<DialogHeader>
<DialogTitle>Title</DialogTitle>
<DialogDescription>Description</DialogDescription>
</DialogHeader>
</DialogContent>
</Dialog> Examples
With form
Copy to clipboard
Edit profile
Make changes to your profile here.
<Dialog>
<DialogTrigger>
<Button variant="outline">Edit Profile</Button>
</DialogTrigger>
<DialogOverlay />
<DialogContent>
<DialogHeader>
<DialogTitle>Edit profile</DialogTitle>
<DialogDescription>Make changes to your profile here.</DialogDescription>
</DialogHeader>
<div class="grid gap-4 py-4">
<div class="grid gap-2">
<Label for="name">Name</Label>
<Input id="name" value="Michael Andreuzza" />
</div>
<div class="grid gap-2">
<Label for="username">Username</Label>
<Input id="username" value="@Mike_andreuzza" />
</div>
</div>
<DialogFooter>
<Button>Save changes</Button>
</DialogFooter>
</DialogContent>
</Dialog>
<Dialog>
<DialogTrigger>
<Button variant="outline">Edit Profile</Button>
</DialogTrigger>
<DialogOverlay />
<DialogContent>
<DialogHeader>
<DialogTitle>Edit profile</DialogTitle>
<DialogDescription>Make changes to your profile here.</DialogDescription>
</DialogHeader>
<div class="grid gap-4 py-4">
<div class="grid gap-2">
<Label for="name">Name</Label>
<Input id="name" value="Michael Andreuzza" />
</div>
<div class="grid gap-2">
<Label for="username">Username</Label>
<Input id="username" value="@Mike_andreuzza" />
</div>
</div>
<DialogFooter>
<Button>Save changes</Button>
</DialogFooter>
</DialogContent>
</Dialog> <Dialog>
<DialogTrigger>
<Button variant="outline">Edit Profile</Button>
</DialogTrigger>
<DialogOverlay />
<DialogContent>
<DialogHeader>
<DialogTitle>Edit profile</DialogTitle>
<DialogDescription>Make changes to your profile here.</DialogDescription>
</DialogHeader>
<div class="grid gap-4 py-4">
<div class="grid gap-2">
<Label for="name">Name</Label>
<Input id="name" value="Michael Andreuzza" />
</div>
<div class="grid gap-2">
<Label for="username">Username</Label>
<Input id="username" value="@Mike_andreuzza" />
</div>
</div>
<DialogFooter>
<Button>Save changes</Button>
</DialogFooter>
</DialogContent>
</Dialog>
Anatomy
Dialog- The root container that manages stateDialogTrigger- The element that opens the dialogDialogOverlay- The backdrop behind the dialogDialogContent- The dialog panel with close buttonDialogHeader- Container for title and descriptionDialogTitle- The dialog headingDialogDescription- Secondary descriptive textDialogFooter- Container for action buttons
Props
All Dialog components accept class for additional CSS classes. They are structural components without specific props.