form-field — wyrd.component.switch

Switch

Binary form control that exposes checked state and emits one canonical checked-change event.

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

<WyrdSwitch checked={false}>
  Email notifications
</WyrdSwitch>

// events: onCheckedChange
checked state: checked
Usage
import { WyrdSwitch } from "@wyrd-company/react";

<WyrdSwitch defaultChecked>
  Email notifications
</WyrdSwitch>

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

<WyrdSwitch checked isDisabled>
  Email notifications
</WyrdSwitch>

// events: onCheckedChange
02

Properties

NameTypeDefaultSummary
checked boolean false Controlled checked state.
default-checked boolean false Initial uncontrolled checked state.
is-disabled boolean false Prevents toggling and exposes disabled platform semantics.
is-required boolean false Marks the switch as required in form semantics.
03

Slots & events

SlotCardinalityAcceptsSummary
label exactly-one text, node Visible label and accessible-name source.
EventPayloadSummary
checked-change checked, action Canonical checked-state change event carrying the next boolean value.
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
root.gap spacing.sm
track.width spacing.xl
track.height spacing.lg
track.radius rounded.full
track.background-unchecked color.outline
track.background-checked color.primary
track.background-disabled color.disabled
thumb.size spacing.md
thumb.background-unchecked color.surface
thumb.background-checked color.on-primary
thumb.background-disabled color.on-disabled
label.color color.on-surface
label.text typography.label-md
focus.color color.primary
focus.width 2px
focus.offset 2px
05

States

StateSourceSummary
default platform Enabled unchecked state.
checked property Checked state derived from checked or default-checked.
focus-visible platform Keyboard-visible focus state.
disabled property Disabled state derived from is-disabled.
required property Required state derived from is-required.
06

Accessibility

From the contract's accessibility obligations. Role switch; Label slot provides the accessible name.

  • Space toggles the switch.
  • Tab moves focus into and out of the switch in document order.
  • Checked, required, and disabled states are exposed through platform semantics.
  • The accessible name remains stable as the checked state changes.
  • Verified under: rtl, reduced-motion, cvd-deuteranopia, density-compact, text-expansion.
07

SDUI

Status: serializable. Checked-change serializes to a named binding/action channel.

SerializableMembers
Propertieschecked, default-checked, is-disabled, is-required
Slotslabel
Eventschecked-change
The Wyrding Way — a contract-first design system. © Wyrd Company