Dialog
A focused task in a native modal dialog. The rest of the page is inert while it is open.
When to use it. Use for a short task that needs focused attention; use an ordinary page for a long workflow.
Dialog primary example
How it works
-
<.dialog>A button with command=show-modal and commandfor opens a real dialog. Stable IDs connect the title, description and invoker. closedby defaults to closerequest; none requires explicit close and any also allows light dismiss. -
package CSSPackage CSS adds the optional presentation only when its complete capability gate passes. Requires native dialog, declarative commandfor/command invocation and closedby. CSS backdrops, bounded layout and discrete transitions are presentation only. -
gallery onlyTheme switching, source copying, search, fixtures, and inspection controls on this page belong to the gallery only; :dialog does not ship them. -
application boundaryDialog and Drawer are modal; Alert Dialog adds consequence semantics and safe cancel focus. Popover is nonmodal; Dropdown Actions contains ordinary controls, not ARIA menus. Tooltip and Hover Card are supplemental only. Use ordinary links for destinations, buttons for actions and visible Help for required guidance. Interest invokers and interactive previews are deferred.
Examples use package semantic tokens in explicit light and dark scopes.
Accessibility and browser support
A title names the dialog and an optional description explains it. Native Tab stays inside, Escape follows closedby, and the explicit Close button always provides an exit. Initial focus may be auto, content or close; native restoration can vary with browser keyboard preferences.
| Feature | Locked-engine evidence | When missing |
|---|---|---|
| Native baseline | Reviewed in the locked Chromium, Firefox, and WebKit evidence matrix. | Always-visible ordinary content below remains available. Without script, native controls still work when their required platform features exist. Without CSS, native dialogs/popovers still need invocation; supplemental content is visible in flow. Without invokers or Popover, use the ordinary alternative. Without anchors use bounded default placement; without transitions or with reduced motion it snaps. No hover/coarse pointer retains the complete trigger or link. Forced colors preserves borders and focus; narrow/zoomed text wraps, RTL uses logical edges or supplemental flow. Replacing the subtree does not restore its open state or focus. |
| Progressive enhancement | The locked-engine evidence exercises the authored complete capability gate. | Always-visible ordinary content below remains available. Without script, native controls still work when their required platform features exist. Without CSS, native dialogs/popovers still need invocation; supplemental content is visible in flow. Without invokers or Popover, use the ordinary alternative. Without anchors use bounded default placement; without transitions or with reduced motion it snaps. No hover/coarse pointer retains the complete trigger or link. Forced colors preserves borders and focus; narrow/zoomed text wraps, RTL uses logical edges or supplemental flow. Replacing the subtree does not restore its open state or focus. |
| Exact fallback | The locked-engine matrix retains the documented native or static outcome. | Always-visible ordinary content below remains available. Without script, native controls still work when their required platform features exist. Without CSS, native dialogs/popovers still need invocation; supplemental content is visible in flow. Without invokers or Popover, use the ordinary alternative. Without anchors use bounded default placement; without transitions or with reduced motion it snaps. No hover/coarse pointer retains the complete trigger or link. Forced colors preserves borders and focus; narrow/zoomed text wraps, RTL uses logical edges or supplemental flow. Replacing the subtree does not restore its open state or focus. |
Ordinary alternative: complete information and controls
Read the complete manual and review preferences here without opening a surface. No data is saved or deleted.
Practical guidance, also available in the complete manual. Also available as plain text.
معلومات إضافية متاحة أيضًا في الدليل الكامل.
Required help stays visible. A real application must provide its complete task here or at an ordinary route, not only inside an overlay.
Application ownership and API
Applications own routes, authorization, CSRF, validation, persistence, loading, outcomes and replacement. Replacing an open subtree may close it and lose native focus; these examples do not restore it or synchronize state. No real operation is executed.
Choosing the related control. Dialog and Drawer are modal; Alert Dialog adds consequence semantics and safe cancel focus. Popover is nonmodal; Dropdown Actions contains ordinary controls, not ARIA menus. Tooltip and Hover Card are supplemental only. Use ordinary links for destinations, buttons for actions and visible Help for required guidance. Interest invokers and interactive previews are deferred.
Provenance
Catalogue identity overlays.dialog, adapted from
unscripted/ui commit bd8f403030c8d1f46804da6eda733fde7e908e63
under its MIT notice.
The documentation presentation is adapted locally; ShadcnUI's Phoenix API and native semantic contract remain authoritative.
Adapt Dialog presentation to an initially closed native dialog with declarative invoker commands, deterministic relationships, closed dismissal and autofocus intent, explicit exit and fallback regions, and no package JavaScript.