Your ImageYour Image
  • About
  • Components
  • About
  • Components
  • Pricing
  • Contact
Book an Intro call
logo

I create digital experiences that connect and inspire. I build apps, websites, brands, and products end-to-end.

  • About
  • Components
  • Pricing
  • Blogs
  • Showcase
  • Contact
  • Privacy
  • Terms
  • Cookie
© 2025Made with by Ali Imam

  • Accordion
  • Alert Dialog
  • Alert
  • Aspect Ratio
  • Avatar
  • Badge
  • Breadcrumb
  • Button
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • Data Table
  • Date Picker
  • Dialog
  • Drawer
  • Dropdown Menu
  • Input
  • Label
  • Navigation Menu
  • Pagination
  • Popover
  • Progress
  • Radio Group
  • Scroll-area
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Sonner
  • Switch
  • Table
  • Tabs
  • Textarea
  • Toggle Group
  • Toggle
  • Tooltip
  • Typography

Dialog

PreviousNext

A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.

Docs API Reference

Component dialog-demo not found in registry.

Installation

pnpm dlx shadcn@latest add dialog

Usage

import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog"
<Dialog>
  <DialogTrigger>Open</DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Are you absolutely sure?</DialogTitle>
      <DialogDescription>
        This action cannot be undone. This will permanently delete your account
        and remove your data from our servers.
      </DialogDescription>
    </DialogHeader>
  </DialogContent>
</Dialog>

Examples

Custom close button

Component dialog-close-button not found in registry.

Notes

To use the Dialog component from within a Context Menu or Dropdown Menu, you must encase the Context Menu or Dropdown Menu component in the Dialog component.

components/example-dialog-context-menu.tsx
<Dialog>
  <ContextMenu>
    <ContextMenuTrigger>Right click</ContextMenuTrigger>
    <ContextMenuContent>
      <ContextMenuItem>Open</ContextMenuItem>
      <ContextMenuItem>Download</ContextMenuItem>
      <DialogTrigger asChild>
        <ContextMenuItem>
          <span>Delete</span>
        </ContextMenuItem>
      </DialogTrigger>
    </ContextMenuContent>
  </ContextMenu>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Are you absolutely sure?</DialogTitle>
      <DialogDescription>
        This action cannot be undone. Are you sure you want to permanently
        delete this file from our servers?
      </DialogDescription>
    </DialogHeader>
    <DialogFooter>
      <Button type="submit">Confirm</Button>
    </DialogFooter>
  </DialogContent>
</Dialog>
Date PickerDrawer

On This Page

InstallationUsageExamplesCustom close buttonNotes