Component API

<modal-dialog>

Open live example

Generic centered modal-dialog shell: a native modal <dialog> card with
header chrome, a close button, and an arbitrary slotted body — the modal
sibling to slide-panel (fixed-edge) and popover-panel (anchored).
Unlike confirm-dialog, it has no baked-in actions; the consumer supplies
the body content (a form, a read-only viewer, a table) and any footer
buttons itself. Instant open/close, no transition. Because it uses
showModal(), it renders in the browser's top layer, makes the rest of the
page inert, contains focus, and restores focus to the trigger on close;
Escape is routed to the topmost layer only (see utils/layer-stack).

Install

import "@f-ewald/components/modal-dialog.js";

Usage

<modal-dialog open heading="Changelog" dismissible>
  Dialog body content goes here.
</modal-dialog>

Attributes / properties

PropertyAttributeTypeDefaultDescription
openopenbooleanfalseWhether the dialog is visible.
headingheadingstring""Title text shown in the dialog header (overridable via slot="title").
sizesizeModalDialogSize"default""lg" widens the dialog to 60rem for content like tables; "default" is 25rem; "fullscreen" covers the entire viewport edge-to-edge with no border-radius or overlay padding.
dismissibledismissiblebooleanfalseWhen true, clicking the backdrop also closes the dialog (off by default — safe for forms with unsaved input).

Events

EventDescription
panel-closeUser clicked the close (✕) button, pressed Escape, or (when dismissible) clicked the backdrop.

Slots

SlotDescription
(default)Dialog body content.
titleOverrides the header title text (falls back to the heading property).

CSS custom properties

Custom property
--ui-border
--ui-border-width
--ui-focus-ring
--ui-font
--ui-font-size-lg
--ui-font-weight-semibold
--ui-line-height-tight
--ui-overlay
--ui-radius
--ui-radius-sm
--ui-shadow-lg
--ui-surface
--ui-surface-muted
--ui-text
--ui-text-muted