action — wyrd.component.button

Button

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

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

01

Examples

Generated from the contract's examples block. Previews render from the Playground tokens — change a value there and everything below follows.

primary state: default
import { Button } from "@wyrd-company/react";

<Button variant="primary" onPress={onPress}>
  Save changes
</Button>
loading state: loading
import { Button } from "@wyrd-company/react";

<Button variant="primary" isLoading onPress={onPress}>
  Save changes
</Button>
danger state: default
import { Button } from "@wyrd-company/react";

<Button variant="danger" onPress={onPress}>
  Delete
</Button>

02

Anatomy

Callouts read from the contract: the parts map, token bindings, and the required label slot.

ANATOMYButtoncontract-fed
Button Fill: color.primary. label slot: label · required. Radius: rounded.md. Focus: focus-visible · platform Continue FILL color.primary LABEL SLOT label · required RADIUS rounded.md FOCUS focus-visible · platform

FIG. 1 parts: root · label · icon 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. Color swatches show the value of the brand currently selected in the Playground.

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
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 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.
  • 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