DocsPlatform
Segmented
Segmented and ToggleGroup are the same selection machine, covering both single and multiple selection. It owns which items are disabled and where focus roves. All four layers share the one behaviour contract.
Live machine
The shipped segmentedMachine in single mode over three views, with roving focus separate from the committed value.
segmented · live via createService
States · walked from the machine
Transitions from here · click to send
Context
{
"type": "single",
"value": "list",
"mode": "uncontrolled"
}Log · newest first
No events yet — use the component above or send a transition.
The layers
Machine is pure state with no DOM. Headless maps that state to framework-native anatomy and ARIA. Styled keeps the existing Grassroot visual recipe while delegating behaviour. Vanilla mounts the same headless contract without a framework.
Behaviour contract
The machine owns single and multiple value shapes, disabled guards, roving focus, and controlled value requests. Adapters translate DOM events and render machine snapshots. Not one of them keeps a second reducer or re-filters the collection behind your back.
- Controlled bindings emit serialisable change requests, and only adopt the parent's state once it comes back in through input.
- Uncontrolled bindings commit straight to machine state, and still emit the same request object, so a consumer can watch either way.
- Keyboard, pointer, focus, dismissal, and accessibility behaviour are shared across vanilla, React, Vue, Solid, Svelte, and Angular.
Evidence
The authoritative source files are:
packages/ui-machines/src/segmented/index.tspackages/ui-headless/core/src/segmented/segmented.spec.mdpackages/ui-headless/core/src/segmented/vanilla.tspackages/ui-headless/browser-contract/segmented.contract.ts, the shared browser assertions.- Each framework package has a matching
browser/segmented.spec.tscontract entry.