overlay — wyrd.component.dialog

Dialog

Overlay surface with canonical open state, dismissal policy, focus management, and reduced-motion behavior.

Install @wyrd-company/react or the Flutter package and use it directly — your DESIGN.md does the styling.

01

Examples

Generated from the contract's examples block. Previews are the published @wyrd-company/react component, themed by the brand's role tokens — flip the site's light/dark toggle and they follow.

Code target Applies to every example on component pages.
usage state: closed

Closed by contract

Confirm changes

Review the changes before continuing.
Usage
import { useState } from "react";
import { WyrdButton, WyrdDialog } from "@wyrd-company/react";

export function DialogInteractionExample() {
  const [open, setOpen] = useState(false);
  const close = () => setOpen(false);
  return <>
    <WyrdButton onPress={() => setOpen(true)}>Review changes</WyrdButton>
    <WyrdDialog isOpen={open} isModal title="Confirm changes" onOpenChange={(event) => !event.isOpen && close()}
      actions={<><WyrdButton variant="ghost" onPress={close}>Cancel</WyrdButton><WyrdButton onPress={close}>Continue</WyrdButton></>}>
      Review the changes before continuing.
    </WyrdDialog>
  </>;
}
closed state: closed

Closed by contract

Confirm changes

Review the changes before continuing.
Usage
import { WyrdDialog } from "@wyrd-company/react";

<WyrdDialog isOpen={false} title="Confirm changes">
  Review the changes before continuing.
</WyrdDialog>

// events: onOpenChange, onDismiss
open state: open

Confirm changes

Review the changes before continuing.
Usage
import { WyrdDialog } from "@wyrd-company/react";

<WyrdDialog defaultOpen isModal title="Confirm changes" actions="Cancel | Continue">
  Review the changes before continuing.
</WyrdDialog>

// events: onOpenChange, onDismiss
alertdialog state: open

Delete project?

This action permanently deletes the project and cannot be undone.
Usage
import { WyrdDialog } from "@wyrd-company/react";

<WyrdDialog defaultOpen isModal variant="alertdialog" title="Delete project?" actions="Cancel | Delete">
  This action permanently deletes the project and cannot be undone.
</WyrdDialog>

// events: onOpenChange, onDismiss
Host contract fixture explicit native top layer

Native overlay host contract

This bounded fixture verifies explicit top-layer ownership and recovery.
02

Anatomy

The specimen is the same published React component and contract example used above. Indexed markers identify only regions the contract can ground; the typed ledger keeps parts, slots, states, and semantic token bindings distinct.

ANATOMY · LIVE SPECIMEN Dialog open example · contract-derived

Confirm changes

Review the changes before continuing.
  1. Part surface Dialog surface container.

    The visible overlay surface.

  2. Part title Title region.

    The visible title region.

  3. Slot body Dialog body content.

    The example's body content region.

  4. Slot actions Dialog action area.

    The example's action region.

  5. Token panel.background color.surface-container

    The semantic panel background token applied to the surface.

Parts

  • backdropModal backdrop.
  • surfaceDialog surface container.
  • titleTitle region.
  • bodyBody region.
  • actionsAction region.

Slots

  • titleRequired · exactly-one
  • bodyRequired · one-or-many
  • actionsOptional · zero-or-many

States

  • closedDialog is absent from the active overlay surface.
  • openingDialog is entering and focus is moving into the surface.
  • openDialog is visible and owns modal focus semantics.
  • dismissingDialog is exiting and focus is restoring.

Tokens

  • panel.backgroundcolor.surface-container
  • panel.foregroundcolor.on-surface
  • panel.border-colorcolor.outline
  • scrim.colorcolor.on-background
  • scrim.opacityopacity.muted
  • border-width1px
  • radiusrounded.lg
  • padding-xspacing.lg
  • padding-yspacing.lg
  • gapspacing.md

FIG. 1 parts: backdrop · surface · title · body · actions TOL. ±0

03

Properties

NameTypeDefaultSummary
is-open boolean false Controlled open state.
default-open boolean false Initial uncontrolled open state.
is-modal boolean true Makes background content inert while the dialog is open.
dismissible boolean true Allows Escape, backdrop (dialog variant only), and platform back navigation to request dismissal.
variant dialog | alertdialog dialog Selects ordinary dialog semantics or urgent alertdialog semantics.
04

Slots & events

SlotCardinalityAcceptsSummary
title exactly-one text, node Dialog title and accessible-name source.
body one-or-many content, node Dialog body content.
actions zero-or-many action, component Dialog action area.
EventPayloadSummary
open-change is-open, reason Canonical open-state change event.
dismiss reason Dismissal request emitted before a dismissible dialog closes.
05

Tokens

The contract's token bindings. Open the shared contextual sidebar from any example; primary swatches reflect the color you pick there. Error swatches show the active preset's values; editing any knob switches to custom and resets error to TWW · Ink.

BindingToken
panel.background color.surface-container
panel.foreground color.on-surface
panel.border-color color.outline
scrim.color color.on-background
scrim.opacity opacity.muted
border-width 1px
radius rounded.lg
padding-x spacing.lg
padding-y spacing.lg
gap spacing.md
06

States

StateSourceSummary
closed behavior-runtime Dialog is absent from the active overlay surface.
opening behavior-runtime Dialog is entering and focus is moving into the surface.
open behavior-runtime Dialog is visible and owns modal focus semantics.
dismissing behavior-runtime Dialog is exiting and focus is restoring.
07

Accessibility

From the contract's accessibility obligations. Role Dialog variant uses dialog; alertdialog variant uses alertdialog.; Title slot provides the accessible name.

  • Escape requests dismissal when dismissible is true.
  • Tab and Shift+Tab cycle inside a modal dialog.
  • Modal dialog makes background content inert on web targets.
  • Focus moves into the dialog on open and restores to trigger or return target on close.
  • Alertdialog wires its accessible description to the body content.
  • Verified under: rtl, reduced-motion, cvd-deuteranopia, text-expansion, safe-area.
08

SDUI

Status: partial. Open-state data is serializable; overlay host coordination, focus trap, inert background, and platform back behavior require host effects.

SerializableMembers
Propertiesis-open, default-open, is-modal, dismissible, variant
Slotstitle, body, actions
Eventsopen-change, dismiss
The Wyrding Way — a contract-first design system. © Wyrd Company