Dialog

Modal window that overlays content and requires user interaction

Preview

Installation

Usage

Examples

Controlled

Manage dialog open state programmatically.

With Form

Include form elements within the dialog.

Scrollable Content

Handle long content with scrolling.

No Close Button

Hide the default close button.

Nested Dialogs

Stack multiple dialogs on top of each other.

Use the inset variant for a muted footer background that extends to the dialog edges.

Detached Trigger

Place the trigger outside of the Dialog component using createDialogHandle().

Non-Modal

Pass modal={false} for a floating dialog that keeps the page interactive. The backdrop is hidden, pointer events pass through the empty area around the popup, and outside clicks don't dismiss the dialog.

Open the dialog, then try clicking or typing below. The page stays interactive and outside clicks don't close the dialog.

Elements Outside Popup

Place elements visually outside the popup card while keeping them inside the popup component for accessibility (tab order, screen reader support). The popup uses pointer-events: none so backdrop clicks work, while inner content uses pointer-events: auto.

API Reference

The Dialog component is built on top of Base UI's Dialog. All Base UI props are supported. The documentation below only covers custom props and modified defaults specific to our implementation.

For the complete Base UI API, see the Base UI Dialog documentation.

Utilities

createDialogHandle

Creates a handle that connects a dialog to one or more external DialogTrigger components. Useful when the triggers need to live outside the Dialog — for example, when each row in a list has its own trigger but they all share one dialog.

Passing data from the trigger to the dialog

The handle accepts an optional <Payload> generic that types a value each trigger can pass along. The dialog reads it through a render-prop child, so you can render different content per trigger without duplicating the dialog markup.

Without the <User> generic, payload inside the render prop resolves to unknown.

Props

Dialog

Root component. Forwards all props to Base UI's Dialog.Root, with modified defaults for the modal prop.

Prop

DialogContent

Dialog container with centered positioning. Composes Dialog.Portal, Dialog.Viewport, and Dialog.Popup. Also renders Dialog.Backdrop when the dialog is modal. Props are forwarded to Dialog.Popup.

Prop

DialogBody

Scrollable content area within the dialog.

Prop