Dialog
Modal window layered over the page.
Installation
pnpm dlx shadcn@latest add https://yea-ui.vercel.app/r/dialog.json
Usage
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "@/components/ui/dialog"<Dialog>
<DialogTrigger render={<Button variant="secondary" />}>Open</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Are you sure?</DialogTitle>
</DialogHeader>
<DialogDescription>This cannot be undone.</DialogDescription>
<DialogFooter>
<DialogClose render={<Button variant="outline" />}>Cancel</DialogClose>
<DialogClose render={<Button variant="negative" />}>Delete</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>Examples
Search
A wider dialog without a close button, for search and quick actions.
API reference
Dialog
Alias for the Base UI Dialog root. Supports open, defaultOpen and onOpenChange.
DialogTrigger
Opens the dialog. Use render to reuse an existing button.
DialogContent
Renders the overlay, popup and close button in a portal.
| Prop | Type | Default | Description |
|---|---|---|---|
showCloseButton | boolean | true | Renders the close button in the top right corner. |
DialogHeader, DialogFooter
Layout slots for the title block and the action row.
DialogTitle, DialogDescription
Accessible name and description. Always include a title.
DialogClose
Closes the dialog. Use render to style it as a button.
All other props are forwarded to the underlying Base UI component.
