011
Dialog
OverlayNo decision yet
Customize
Footer
Code
const [open, setOpen] = useState(false);
<Button onClick={() => setOpen(true)}>Open</Button>
<Dialog open={open} onOpenChange={setOpen}>
<DialogHeader>
<DialogTitle>Delete draft?</DialogTitle>
<DialogClose />
</DialogHeader>
<DialogDescription>This cannot be undone.</DialogDescription>
<DialogFooter>
<Button variant="ghost" onClick={() => setOpen(false)}>Cancel</Button>
<Button variant="solid" onClick={confirm}>Delete</Button>
</DialogFooter>
</Dialog>Install
npx shadcn@latest add https://components.haedong.dev/r/dialog.json
Props
Dialog props below. DialogHeader is a baseline row; DialogTitle and DialogDescription label and describe the dialog; DialogFooter right-aligns actions; DialogClose is a muted text button (children = label, default "Close"). Renders through a portal into <body>.
| Prop | Type | Description |
|---|---|---|
| open | boolean | Controlled visibility. |
| onOpenChange | (open: boolean) => void | Called with false on Esc, backdrop click or DialogClose. |
| aria-label | string | Labels the dialog when there is no DialogTitle. |
| className | string | Extra classes for the panel (default max-w-md, 12px from the viewport edges). |