action — wyrd.component.toggle-group

ToggleGroup

Single- or multiple-selection collection of toolbar-style toggle buttons.

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.
single state: pressed
Usage
import { WyrdToggleGroup } from "@wyrd-company/react";

<WyrdToggleGroup label="Text alignment" type="single" defaultValues={["center"]} items={[{"value":"left","label":"Align left"},{"value":"center","label":"Align center"},{"value":"right","label":"Align right"}]} />

// events: onValuesChange
multiple state: pressed
Usage
import { WyrdToggleGroup } from "@wyrd-company/react";

<WyrdToggleGroup label="Text formatting" type="multiple" defaultValues={["bold","italic"]} items={[{"value":"bold","label":"Bold"},{"value":"italic","label":"Italic"},{"value":"underline","label":"Underline"}]} />

// events: onValuesChange
disabled-item state: disabled
Usage
import { WyrdToggleGroup } from "@wyrd-company/react";

<WyrdToggleGroup label="Text alignment" items={[{"value":"left","label":"Align left"},{"value":"center","label":"Align center","disabled":true},{"value":"right","label":"Align right"}]} />

// events: onValuesChange
02

Properties

NameTypeDefaultSummary
label string undefined Accessible name for the toggle group.
type single | multiple single Whether activation selects one item or independently toggles many items.
values array undefined Controlled selected item values; single mode uses at most one value.
default-values array Initial uncontrolled selected item values.
items array Ordered toggle button items; disabled items render but are skipped by navigation and activation.
is-disabled boolean false Prevents navigation and selection changes for the collection.
03

Slots & events

EventPayloadSummary
values-change values, action Canonical event carrying the complete requested selected values array.
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
item.background color.surface
item.foreground color.on-surface
item.background-hover color.secondary
item.pressed-background color.secondary
item.pressed-foreground color.on-secondary
item.disabled-background color.disabled
item.disabled-foreground color.on-disabled
item.padding-x spacing.md
item.padding-y spacing.sm
radius rounded.md
gap spacing.xs
label typography.label-md
05

States

StateSourceSummary
default platform Enabled collection.
pressed property Persistent selected state on one or more items.
focus-visible platform Keyboard-visible focus on the roving item.
disabled property Disabled collection or item state.
06

Accessibility

From the contract's accessibility obligations. Role group; Consumer-provided aria-label or surrounding labelled context names the group.

  • In single mode, Tab moves focus into the roving enabled item and out of the group.
  • In single mode, ArrowLeft and ArrowRight move focus between enabled items with wrap-around and follow visual direction in RTL.
  • In single mode, ArrowUp and ArrowDown move focus between enabled items with wrap-around.
  • In single mode, Home and End move focus to the first and last enabled items.
  • In multiple mode, Tab moves through every enabled item in natural document order.
  • Enter and Space toggle the focused enabled item.
  • Web projections expose role=group with the required label property applied as aria-label, and native buttons with aria-pressed.
  • Single mode maintains at most one pressed item; activating the pressed item clears selection.
  • Multiple mode exposes independent pressed states.
  • Disabled items are skipped by single-mode roving focus and cannot be activated.
  • Verified under: rtl, reduced-motion, cvd-deuteranopia, density-compact, text-expansion.
07

SDUI

Status: serializable. Items serialize as ordered records; the group owns selection and roving focus while each item retains pressed-button semantics.

SerializableMembers
Propertieslabel, type, values, default-values, items, is-disabled
Slots
Eventsvalues-change
The Wyrding Way — a contract-first design system. © Wyrd Company