Skip to content
SevenUI
Sign in
On this page

Dialog

A window overlaid on either the primary window or another dialog window, rendering the content underneath inert, built on the Base UI Dialog primitive.

Installation

Bash

Usage

API reference

Dialog

Extends the Base UI Dialog Root — all its props apply. Base UI has no dismissible prop; use disablePointerDismissal instead.

PropTypeDefault
open / defaultOpenbooleanfalse
onOpenChange(open, eventDetails) => void—
onOpenChangeCompletefires after animations finish—
modaltrue | false | "trap-focus"true
disablePointerDismissalboolean — outside press keeps it openfalse
actionsRefref with imperative close()/unmount()—
handleDialog.Handle — pairs with detached triggers—
triggerId / defaultTriggerIdstring | null — which trigger opened it—

Detached triggers (createHandle)

The primitive’s Dialog.createHandle() connects triggers and a dialog that are not co-located in the tree: create a handle, pass it to any number of DialogTriggers (optionally with a typed payload and id) and to the Dialog root. The root’s children can be a render function receiving { payload }, so one dialog renders trigger-specific content. Our wrappers pass these props straight through:

DialogContent

Content is centered by a Dialog.Viewport — long content scrolls the viewport, not the page. A dialog with another dialog open inside it exposes data-nested-dialog-open on its Popup and the --nested-dialogs CSS variable, useful for dimming or scaling background dialogs.

PropTypeDefault
showCloseButtonboolean — built-in ✕true
initialFocus / finalFocusfocus target on open/close—

DialogFooter

Extends div — the muted footer bar.

PropTypeDefault
showCloseButtonboolean — appends an outline Close buttonfalse

DialogTrigger, DialogClose, DialogHeader, DialogTitle, DialogDescription, DialogOverlay, DialogPortal

Styled Base UI parts. Trigger (a button; also takes handle / payload / id for detached use) and Close accept the render prop for custom elements (e.g. render={<Button />}). DialogPortal takes container and keepMounted (default false); DialogOverlay is the Backdrop — nested dialogs hide the parent’s backdrop automatically (forceRender on the primitive overrides that). Title renders an <h2>, Description a <p> — keep both for accessible labeling, or render them sr-only.

Was this page helpful?