--- title: Dialog description: A window overlaid on either the primary window or another dialog window, rendering the content underneath inert. featured: true component: true links: doc: https://www.radix-ui.com/docs/primitives/components/dialog api: https://www.radix-ui.com/docs/primitives/components/dialog#api-reference --- ## Installation CLI Manual ```bash npx shadcn@latest add dialog ``` Install the following dependencies: ```bash npm install @radix-ui/react-dialog ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx showLineNumbers import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog" ``` ```tsx showLineNumbers Open Are you absolutely sure? This action cannot be undone. This will permanently delete your account and remove your data from our servers. ``` ## Examples ### Custom close button ## 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. ```tsx showLineNumbers title="components/example-dialog-context-menu.tsx" {1, 26} Right click Open Download Delete Are you absolutely sure? This action cannot be undone. Are you sure you want to permanently delete this file from our servers? ```