Dialog

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

Overview and decision boundary

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

Do not use Dialog for long, multi-page workflows.

Preview

import { Button, Dialog, DialogFooter } from '@nerio-ui/ui/client';<Dialog trigger="Open dialog" title="Share collection">  ...  <DialogFooter>    <Button variant="secondary">Cancel</Button>    <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 dlx 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 variant="secondary">Cancel</Button>    <Button>Share</Button>  </DialogFooter></Dialog>

Variants

VariantPurpose
TaskShort focused task with clear completion.
ConfirmationDecision point for sensitive actions.

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 heading.
descriptionOptional supporting context.
bodyTask, decision, and action content.
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.
  • Includes a title and optional description.
  • 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.

API

PropPurpose
triggerReact node or text that opens the dialog.
title / descriptionAccessible dialog heading and optional context.
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 6 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, confirmation, or 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.

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-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.