Overlays

Dialog

A focused, modal task lifted out of the page.

Importimport { Dialog } from "@/components/ui/Dialog";
Sourcesrc/components/ui/Dialog

A modal task lifted out of the page. Every Dialog needs a DialogTitle — it is what names the dialog to a screen reader. If the dialog confirms something destructive, use AlertDialog instead.

Default

DialogTrigger asChild hands the trigger behaviour to your own button rather than rendering a second one. DialogClose asChild does the same for the footer.

Controlled

Pass open and onOpenChange when something other than the trigger needs to open or close the dialog — a keyboard shortcut, or a save that should only dismiss on success.

Props

Dialog

PropTypeDefaultDescription
openbooleanControlled open state.
defaultOpenbooleanfalseUncontrolled initial state.
onOpenChange(open: boolean) => voidCalled whenever the dialog opens or closes.

DialogContent

PropTypeDefaultDescription
hideOverlaybooleanfalseDrops the scrim. Used by the command palette.
showClosebooleantrueRenders the corner close button.
overlayClassNamestringClasses for the scrim rather than the panel.

DialogTrigger / DialogClose

PropTypeDefaultDescription
asChildbooleanfalseApply the behaviour to your own element instead of rendering a button.