Skip to documentation

Design system / Molecules

Molecule / Disclosure

Dialog

Dialog provides Radix-backed modal disclosure, focus handling and portaled content. The caller supplies a title, description and exit paths. Drafts, commands and operation outcomes belong to the content owner.

Live example

Live preview

Current component with fictional data. Example changes are not persisted.

Responsibility

Trigger, overlay and named content form one modal-disclosure contract. A multi-field editor inside the dialog retains its own workflow and taxonomy. Portaled placement does not make that workflow part of the container's API.

Public contract

The table describes supported inputs, exported parts and caller responsibilities. A callback supplies a command, such as saving a draft. These notes are maintained manually; check current source types before integration.

Maintained component API notes; current source is authoritative
Prop / partTypeRequirementResponsibility
containerElement | DocumentFragment | nullContent · optionalRadix Portal destination for content and overlay. Supply the owning theme or modal scope to preserve inherited tokens. Omitted retains Radix's document.body default; the caller owns element selection.
open / defaultOpen / onOpenChangeRadix Root propsOptionalControlled or uncontrolled disclosure.
showCloseButtonbooleanContent · default trueIncludes an accessible corner Close control.
showCloseButtonbooleanFooter · default falseAdds an outline Button wrapped by DialogClose.
children / classNamePrimitive or native propsAssembly supplied by consumerTitle, Description, Header and Footer complete the content contract.

API notes are curated documentation, not generated types. The source linked above is the current implementation; update these notes alongside API changes.

State and behavior

Identify which values the caller controls and which behavior the component or underlying primitive owns. A local example does not supply persistence, authorization or a complete product lifecycle.

Radix supplies modal focus and open/close mechanics. The consumer owns the content, any draft, validation and async operation. Closing a container does not imply saving or network cancellation.

Dependencies

  • Radix Dialog Root, Trigger, Portal, Overlay, Content, Title, Description and Close
  • Button for optional footer close
  • Lucide X
  • cn()

Token and styling contract

These notes identify theme roles, utilities and direct style values used by the source. Direct colors or timings are implementation exceptions, not recommendations to bypass the theme.

bg-background / border / shadow-lg
Modal content surface.
bg-black/50 / z-50
Overlay and stacking utilities.
text-muted-foreground / text-lg
Description and title utilities.

Boundaries and limitations

  • No submit, pending, error or draft lifecycle is exposed by Dialog itself.
  • Disabling showCloseButton requires another explicit, accessible exit.
  • Radix modal behavior cannot be demonstrated by a static card or native dialog as an exact specimen.
  • The RoundSubmissionsView live example demonstrates container with a fictional tenant-theme scope. The default Dialog example keeps the document.body portal.

Where to make a change

Change shared modal anatomy in dialog.tsx. Keep command execution, form submission and draft policy in the content/controller. Focus, labels, layering and all indirect consumers need consideration when evolving the container.

Selected real uses

CommandDialog

Places the command interface in Dialog and supplies a title, description, open-state props and close-button configuration. This is shared disclosure structure, not evidence of a product command workflow.

src/components/ui/command.tsx

These traces describe selected uses, not every dependency. Repository-only paths are shown as references; only approved files have public source views.

Usage contract

import { Dialog, DialogTrigger, DialogContent, DialogTitle, DialogDescription } from "@/components/ui/dialog";

<Dialog><DialogTrigger>Read details</DialogTrigger>
  <DialogContent><DialogTitle>Details</DialogTitle>
    <DialogDescription>Consumer-supplied explanation.</DialogDescription>
  </DialogContent>
</Dialog>

Illustrative consumer bindings, not a self-contained product workflow. Live examples supply only local state or explicit fictional props.

All molecules
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.