Dialog

Dialogs focus a short decision or task above the current product surface.

Overview and decision boundary

Use Dialog to focus a short task or reversible decision above the current surface.

Do not use Dialog for long, multi-page workflows or sensitive confirmations; keep confirmation policy consumer-owned until the dedicated primitive ships.

import { Button, Dialog, DialogFooter } from '@nerio-ui/ui/client';<Dialog trigger="Open dialog" title="Share collection">  ...  <DialogFooter>    <Button>Share</Button>  </DialogFooter></Dialog>

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm exec nerio add dialogimport { Button, Dialog, DialogFooter } from '@nerio-ui/ui/client';

Usage

import { Button, Dialog, DialogFooter } from '@nerio-ui/ui/client';<Dialog trigger="Open dialog" title="Share collection">  ...  <DialogFooter>    <Button>Share</Button>  </DialogFooter></Dialog>

Variants

VariantPurpose
TaskShort focused task with clear completion.
DecisionReversible choice with an obvious escape path.

Anatomy

SlotPurpose
backdropBackdrop that separates the dialog from the page.
contentModal surface rendered through a portal.
headerTitle, optional description, and close boundary.
headingGrouped title and optional description.
titleRequired accessible dialog name; renders as a neutral 16 px div by default.
descriptionOptional supporting context using the standard 14 px body size.
bodyTask, decision, and action content that scrolls within the viewport boundary.
footerOptional action row aligned to the inline end.
closeSecondary icon Button with a localizable accessible name.

States

StatePurpose
OpenFocus moves into the dialog.
ClosedFocus returns to the trigger.

Motion

  • State changes should use shared motion tokens and preserve reduced-motion behavior.

Accessibility

  • Uses the Base UI Dialog primitive.
  • The title renders as a neutral 16px div by default; titleAs opts into h2-h6 only when the title belongs in the document outline. The optional description uses the standard 14px body size.
  • Focus is trapped while the dialog is open and returns to the trigger on close.
  • Defaults closeLabel to "Close dialog" for the secondary icon Button; provide a localized accessible name when needed.
  • Supports controlled open, uncontrolled defaultOpen, onOpenChange, and a forwarded popup ref.

Review the shared responsibility and evidence boundaries in the Accessibility foundation alongside this component-specific contract. Use the Spacing & layout foundation for shared density, wrapping, overflow, reflow, and component-versus-product ownership guidance. The Color foundation and Typography foundation define the shared visual-role and text-resilience boundaries used by component examples. Component pages document any direction-sensitive or localizable behavior that belongs to their stable contract.

API

PropPurpose
triggerReact node or text that opens the dialog.
title / descriptionAccessible dialog name and optional context. titleAs opts into h2-h6 only when the title belongs in the document outline.
bodyClassNameOptional class hook for the body slot.
DialogFooterComposable footer that keeps modal actions aligned to the inline end.
closeLabelAccessible close-control name; defaults to "Close dialog".

Implementation contract

ContractValue
Registry itemdialog installs 7 source files into the configured components directory.
Base UIdialog
Registry dependenciesbutton
Package dependencies@base-ui/react, @nerio-ui/adapters, clsx, react, tailwind-merge, tailwindcss

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Use Dialog to focus a short task or reversible decision above the current surface.

Do / do not

Do

Use for short decisions that need context without a route change.

Do not

Do not use Dialog for long, multi-page workflows or sensitive confirmations; keep confirmation policy consumer-owned until the dedicated primitive ships.

Tokens

These are the primary customization points. Override semantic or component tokens instead of changing component source.

TokenPurpose
--n-dialog-width-mdPublic customization point for this component contract.
--n-dialog-viewport-insetPublic customization point for this component contract.
--n-dialog-paddingPublic customization point for this component contract.
--n-dialog-header-gapPublic customization point for this component contract.
--n-dialog-header-marginPublic customization point for this component contract.
--n-dialog-body-gapPublic customization point for this component contract.
--n-overlay-z-indexPublic customization point for this component contract.
--n-overlay-floating-z-indexPublic customization point for this component contract.
--n-overlay-backgroundPublic customization point for this component contract.
--n-overlay-borderPublic customization point for this component contract.
--n-overlay-backdropPublic customization point for this component contract.
--n-overlay-backdrop-filterPublic customization point for this component contract.
--n-overlay-foregroundPublic customization point for this component contract.
--n-overlay-foreground-mutedPublic customization point for this component contract.
--n-overlay-control-backgroundPublic customization point for this component contract.
--n-overlay-control-background-hoverPublic customization point for this component contract.
--n-overlay-surface-filterPublic customization point for this component contract.
--n-overlay-shadowPublic customization point for this component contract.
--n-input-background-on-overlayPublic customization point for this component contract.
--n-input-background-on-overlay-hoverPublic customization point for this component contract.
--n-input-foreground-on-overlayPublic customization point for this component contract.
--n-input-placeholder-on-overlayPublic customization point for this component contract.
--n-motion-overlay-enter-durationPublic customization point for this component contract.
--n-motion-overlay-enter-easingPublic customization point for this component contract.
--n-motion-overlay-exit-durationPublic customization point for this component contract.
--n-motion-overlay-exit-easingPublic customization point for this component contract.
--n-focus-ringPublic customization point for this component contract.