Skip to content
nexubDesign System
v12.7.0

Components · Overlays

Dialog

StableAdded v0.0.1

Modal dialog built on Radix UI. Fully accessible with focus trapping and ARIA roles.

import { Dialog } from '@nexub/react';
View as Markdown

Usage

Use it for
  • Confirming a destructive or irreversible action

  • Collecting a small form without leaving the current page

  • Displaying critical information that requires acknowledgement

  • Previewing content before taking an action

Use something else for
  • Long multi-step flows — use a Drawer or a dedicated page instead

  • Quick contextual info — use a Tooltip or Popover

  • Non-blocking side panels — use Sheet or Drawer

  • Stacking multiple dialogs — always limit to one at a time

Playground

Props

surface
TSX
<Dialog.Root open={open} onOpenChange={setOpen}>…</Dialog.Root>

Examples

Default

Props

Props
PropTypeDefaultDescription
openboolean—Controlled open state.
onOpenChange(open: boolean) => void—Callback when open state changes.
defaultOpenbooleanfalseUncontrolled initial open state.
surface'solid' | 'glass''solid'Glass material on Dialog.Content — see Foundations → Materials.
maxHeightstring—11.5 (Dialog.Content): the tallest the dialog gets before its content scrolls, e.g. "32rem". Set through CSSOM (strict CSP safe).

Design tokens

Dialog reads these component tokens. Each one is unset by default and falls back to the semantic role it aliases, so nothing changes until you set it. Set one on any element to restyle every Dialog below it, and leave the roles other components share alone. See the three token tiers.

Dialog and AlertDialog.

Dialog design tokens
TokenAliasesNotes
--dialog-bg--color-surface-elevated—
--dialog-fg--color-on-surface—
--dialog-radius--shape-overlay—
CSS
/* One area of your app */
.checkout {
  --dialog-bg: var(--color-secondary);
}