Components

Dialog

A React dialog with a Liquid Glass surface and a custom action area.

Dialog is a general-purpose modal. It renders the portal, backdrop, centered popup, title, description, optional body, and a custom action area internally.

Unlike AlertDialog, which always blocks backdrop dismissal, Dialog can be dismissed by pressing the backdrop or Escape, and footer can render any number and any kind of action buttons.

Basic example

The component is typically used in controlled mode: open controls visibility and the page renders its own trigger button. Put your buttons in footer and close the dialog with setOpen(false).

Custom actions

footer is a regular React node, so it can hold two, three, or more buttons, or a mix of other controls. Buttons do not close the dialog automatically; update open yourself as the example does.

No release published.

Backdrop dismissal

disablePointerDismissal prevents the backdrop from closing the dialog while Escape still works. Use it for flows that may contain unsaved work.

Accessibility

Dialog renders a modal dialog named by title and described by description. Focus moves into the popup, stays trapped while it is open, and returns to the trigger when it closes.

Escape and backdrop clicks close it by default. disablePointerDismissal stops backdrop clicks only; Escape still closes the dialog. Provide a visible close action in footer. modal={false} relaxes focus trapping and scroll locking. See the accessibility guide for overlay focus rules.

API reference

PropTypeDefaultDescription
titleReactNode—Dialog heading. Required.
descriptionReactNode—Supporting copy under the title.
childrenReactNode—Body content between the description and the action area.
footerReactNode—Bottom action area that can hold any number of controls.
openboolean—Controlled open state.
defaultOpenbooleanfalseInitial open state when uncontrolled.
onOpenChange(open: boolean, details) => void—Called when the dialog opens or closes.
onOpenChangeComplete(open: boolean) => void—Called after the open or close animation finishes.
modalboolean | "trap-focus"trueControls focus trapping and page scroll locking.
disablePointerDismissalbooleanfalsePrevents the backdrop from closing the dialog.
actionsRefRefObject<Actions | null>—Imperative close and unmount actions.
handleDialogHandle—Associates the dialog with external triggers.
triggerIdstring | null—ID of the trigger associated with the dialog.
defaultTriggerIdstring | null—ID of the trigger used for an initially open dialog.
classNamestring—Tailwind classes merged into the popup.
styleCSSProperties—Inline styles merged into the same element as className.
ui{ backdrop?: ClassValue; viewport?: ClassValue; popup?: ClassValue; glass?: ClassValue; overlay?: ClassValue; content?: ClassValue; title?: ClassValue; description?: ClassValue; body?: ClassValue; footer?: ClassValue }—Tailwind classes for internal slots, keyed by data-slot.
AttributeDescription
data-openPresent when the dialog is open.
data-closedPresent when the dialog is closed.
data-starting-stylePresent when the dialog begins animating in.
data-ending-stylePresent when the dialog is animating out.
data-nestedPresent when the dialog is nested within another dialog.
data-nested-dialog-openPresent when another dialog is open inside this one.
data-slotMarks internal parts (backdrop, viewport, popup, glass, overlay, content, title, description, body, footer) for styling.

Theming

The component uses the shared glass material. Tune shared --ui-glass-* tokens on a parent, use className for layout, and use ui for internal slots keyed by data-slot. Component-specific values live in src/theme/dialog.ts. See the theming guide for token layers and presets.

  • Alert Dialog — For destructive confirmations that must not dismiss on backdrop press.
  • Drawer — For edge-aligned panels and mobile layouts.
  • Popover — For compact, non-modal content.