Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Code Block
- Collapsible
- Combobox
- Command
- Context Menu
- Copy Button
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Form
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Page Header
- Pagination
- Panel
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Section Header
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Stat
- Stat Card
- Switch
- Table
- Tabs
- Textarea
- Theme Toggle
- Toggle
- Toggle Group
- Tooltip
- Typography
Dialog
A window overlaid on the primary window.
01
Installation
Add the dialog component with the shadcn CLI.
bash
npx shadcn@latest add https://swiss.ui.unsanity.ai/r/dialog.json02
Usage
tsx
import { Dialog } from "@/components/ui/dialog"03
Examples
Default
import { Button } from "@/components/ui/button"
import {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
<Dialog>
<DialogTrigger render={<Button variant="outline" />}>Open Dialog</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Edit profile</DialogTitle>
<DialogDescription>Make changes to your profile here.</DialogDescription>
</DialogHeader>
<DialogFooter>
<DialogClose render={<Button variant="outline" />}>Cancel</DialogClose>
<Button>Save</Button>
</DialogFooter>
</DialogContent>
</Dialog>