Shadcn UI Components
Dialog
A modal dialog interrupts the user with important content and expects a response. Built on Radix UI Dialog primitive with full accessibility support.
Dialog Examples
Installation
# The component is already installed at:
# src/components/ui/shadcn/dialog.tsx
Usage
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@/components/ui/shadcn/dialog'
export function DialogDemo() {
return (
<Dialog>
<DialogTrigger>Open</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Dialog Title</DialogTitle>
<DialogDescription>
Dialog description goes here.
</DialogDescription>
</DialogHeader>
</DialogContent>
</Dialog>
)
}
Components
| Component | Description |
|---|---|
| Dialog | The root component |
| DialogTrigger | Opens the dialog when clicked |
| DialogContent | The dialog content container |
| DialogHeader | Contains the title and description |
| DialogTitle | The title of the dialog |
| DialogDescription | Describes the dialog purpose |
| DialogFooter | Contains action buttons |
| DialogClose | Closes the dialog |