action — wyrd.component.button

Button

Action primitive that emits one canonical press event from pointer, keyboard, and assistive activation.

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.
primary state: default
Usage
import { WyrdButton } from "@wyrd-company/react";

<WyrdButton variant="primary">
  Save changes
</WyrdButton>

// events: onPress
loading state: loading
Usage
import { WyrdButton } from "@wyrd-company/react";

<WyrdButton variant="primary" isLoading>
  Save changes
</WyrdButton>

// events: onPress
danger state: default
Usage
import { WyrdButton } from "@wyrd-company/react";

<WyrdButton variant="danger">
  Delete
</WyrdButton>

// events: onPress
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 Button primary example · contract-derived
  1. Part root Interactive platform control root.

    The rendered button boundary.

  2. Part label Label content container.

    The visible label region.

  3. Slot label Primary visible label and accessible-name source.

    Where the example supplies Save changes.

  4. Token primary.background color.primary

    The semantic primary background token applied to the root surface.

Parts

  • rootInteractive platform control root.
  • labelLabel content container.
  • iconIcon slot containers.
  • loading-indicatorNon-color-only indeterminate activity indicator shown before the stable label while loading.

Slots

  • labelRequired · exactly-one
  • leading-iconOptional · zero-or-one
  • trailing-iconOptional · zero-or-one

States

  • defaultIdle enabled state.
  • hoverPointer hover state on hover-capable devices.
  • focus-visibleKeyboard-visible focus state.
  • pressedActive press state.
  • disabledDisabled state derived from is-disabled.
  • loadingPending state with a visible activity indicator derived from is-loading.

Tokens

  • primary.backgroundcolor.primary
  • primary.background-hovercolor.primary-hover
  • primary.background-pressedcolor.primary-pressed
  • primary.foregroundcolor.on-primary
  • secondary.backgroundcolor.secondary
  • secondary.foregroundcolor.on-secondary
  • ghost.backgroundtransparent
  • ghost.foregroundcolor.primary
  • danger.backgroundcolor.error
  • danger.foregroundcolor.on-error
  • disabled.backgroundcolor.disabled
  • disabled.foregroundcolor.on-disabled
  • radiusrounded.md
  • padding-xspacing.lg
  • padding-yspacing.sm
  • gapspacing.sm
  • labeltypography.label-md
  • loading-indicator-sizespacing.md
  • loading-indicator-stroke-width2px

FIG. 1 parts: root · label · icon · loading-indicator TOL. ±0

03

Properties

NameTypeDefaultSummary
variant primary | secondary | ghost | danger primary Visual and semantic action emphasis.
is-disabled boolean false Prevents activation and exposes disabled platform semantics.
is-loading boolean false Shows pending action state while preserving dimensions and suppressing duplicate activation.
04

Slots & events

SlotCardinalityAcceptsSummary
label exactly-one text, node Primary visible label and accessible-name source.
leading-icon zero-or-one icon Optional icon before the label in inline flow.
trailing-icon zero-or-one icon Optional icon after the label in inline flow.
EventPayloadSummary
press source, action Canonical activation event emitted once per accepted activation.
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
primary.background color.primary
primary.background-hover color.primary-hover
primary.background-pressed color.primary-pressed
primary.foreground color.on-primary
secondary.background color.secondary
secondary.foreground color.on-secondary
ghost.background transparent
ghost.foreground color.primary
danger.background color.error
danger.foreground color.on-error
disabled.background color.disabled
disabled.foreground color.on-disabled
radius rounded.md
padding-x spacing.lg
padding-y spacing.sm
gap spacing.sm
label typography.label-md
loading-indicator-size spacing.md
loading-indicator-stroke-width 2px
06

States

StateSourceSummary
default platform Idle enabled state.
hover interaction Pointer hover state on hover-capable devices.
focus-visible platform Keyboard-visible focus state.
pressed interaction Active press state.
disabled property Disabled state derived from is-disabled.
loading property Pending state with a visible activity indicator derived from is-loading.
07

Accessibility

From the contract's accessibility obligations. Role button; Label slot or aria-label provides the accessible name.

  • Enter activates the button.
  • Space activates the button.
  • Disabled state is exposed through native disabled semantics where the target has them.
  • Loading state keeps the accessible name stable and prevents duplicate activation.
  • The loading indicator is decorative because aria-busy exposes the pending state while the visible label remains the accessible name.
  • Verified under: rtl, reduced-motion, cvd-deuteranopia, density-compact.
08

SDUI

Status: serializable. Press serializes as an action reference; executable callbacks stay target-local.

SerializableMembers
Propertiesvariant, is-disabled, is-loading
Slotslabel, leading-icon, trailing-icon
Eventspress
The Wyrding Way — a contract-first design system. © Wyrd Company