Skip to content
Zuno UI
Explore components
EXPLORE
Actions
Forms
Layout
Navigation
Data display
Feedback
Overlays
RESOURCES
Components/Dialog

Dialog

A modal window with focus trapping, Escape to close and a backdrop; renders in a portal.

Base UI reference ↗

Installation

Run it from the root of a project already set up with zunoui init.

npx zunoui@latest add dialog

Dependencies

What add dialog installs alongside the component. The CLI skips any you already have in a compatible version.

ZUNO registry

  • @zuno/utils

npm

Examples

4 examples · 1 component
dialog

Modal dialog

Title, description and actions; focus returns to the trigger on close.

dialog

With a Select inside

Required composition: the Select popup opens correctly inside the dialog and in the active theme.

dialog

Large size and long title

size="lg" widens the panel; a long title wraps without running under the X.

dialog

Persistent (does not close on outside click)

dismissible={false} prevents closing on outside click and Escape; combine it with showClose={false} to require an explicit action.

API reference

Keeps the props, events and refs of the matching Base UI primitive, plus ZUNO's styles.

PropTypeDefault
Dialog

Root; accepts open, defaultOpen and onOpenChange.

——
dismissible

When false, backdrop clicks and Escape do not close it: only the X or a DialogClose.

booleantrue
DialogTrigger

Opens the dialog; use render to reuse a Button.

button—
DialogContent

Portaled backdrop and panel; traps focus. Includes a close button in the corner.

div—
size

Maximum panel width: 384, 512 or 672 px.

"sm" | "default" | "lg""default"
showClose

Shows the close X in the corner; set it to false if the footer is the only way out.

booleantrue
DialogTitle

Accessible title of the dialog (aria-labelledby).

h2—
DialogDescription

Associated description (aria-describedby).

p—
DialogClose

Closes the dialog.

button—

States

The states that apply to this component and their visual treatment.

StateTreatment
ClosedOnly the trigger; the content is not mounted needlessly.
OpenPortaled backdrop and panel; focus moves in and stays trapped.
CloseEscape or a backdrop click closes it and returns focus (if dismissible).
Non-dismissibledismissible={false} requires an explicit footer action.

Accessibility

Always include a DialogTitle: it names the dialog for screen readers. Use DialogDescription for context.

Focus moves in on open, stays trapped inside and returns to the trigger on close. Escape and backdrop clicks close it; the panel uses theme tokens, so it keeps Light/Dark inside the portal.