action — wyrd.component.toggle

Toggle

Two-state toolbar-style button with persistent pressed state.

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

<WyrdToggle>
  Bold
</WyrdToggle>

// events: onPressedChange
pressed state: pressed
Usage
import { WyrdToggle } from "@wyrd-company/react";

<WyrdToggle defaultPressed>
  Bold
</WyrdToggle>

// events: onPressedChange
disabled state: disabled
Usage
import { WyrdToggle } from "@wyrd-company/react";

<WyrdToggle isDisabled>
  Bold
</WyrdToggle>

// events: onPressedChange
02

Properties

NameTypeDefaultSummary
pressed boolean undefined Controlled persistent pressed state.
default-pressed boolean false Initial uncontrolled pressed state.
is-disabled boolean false Prevents activation and exposes disabled platform semantics.
03

Slots & events

SlotCardinalityAcceptsSummary
label exactly-one text, node Visible label and accessible-name source.
icon zero-or-one icon Optional icon before the label.
EventPayloadSummary
pressed-change pressed, action Canonical event emitted with the requested persistent pressed state.
04

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
background color.surface
foreground color.on-surface
background-hover color.secondary
pressed-background color.secondary
pressed-foreground color.on-secondary
disabled-background color.disabled
disabled-foreground color.on-disabled
radius rounded.md
padding-x spacing.md
padding-y spacing.sm
gap spacing.sm
label typography.label-md
05

States

StateSourceSummary
default platform Enabled unpressed state.
hover interaction Pointer hover state on hover-capable devices.
focus-visible platform Keyboard-visible focus state.
pressed property Persistent selected state derived from pressed or default-pressed.
disabled property Disabled state derived from is-disabled.
06

Accessibility

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

  • Enter toggles the button.
  • Space toggles the button.
  • Web projections expose persistent state with aria-pressed on a native button.
  • Disabled state is exposed through native disabled semantics where the target has them.
  • Verified under: rtl, reduced-motion, cvd-deuteranopia, density-compact, text-expansion.
07

SDUI

Status: serializable. Toggle is a pressed button, not a form switch; persistent state serializes independently from activation.

SerializableMembers
Propertiespressed, default-pressed, is-disabled
Slotslabel, icon
Eventspressed-change
The Wyrding Way — a contract-first design system. © Wyrd Company