How to build an accessible SegmentedControl in React

Wraps role="radio" buttons in a role="group" with aria-checked marking the selected segment, and ArrowLeft/ArrowRight move selection across enabled segments (skipping disabled ones) so keyboard users get standard single-choice navigation.

When to use a SegmentedControl

When not to use it

Keyboard interactions

Role group, verified at WCAG 2.2-AA.

Common mistakes

Avoid: Two <Button> elements toggling which is "active" via app state

Prefer: <SegmentedControl options={[{label:"Day",value:"day"},{label:"Week",value:"week"}]} value={range} onValueChange={setRange} />

A pair of buttons does not convey exclusive selection; SegmentedControl uses radio semantics with aria-checked and arrow-key navigation so the single-choice state is announced

Example

<SegmentedControl options={[{label:'Day',value:'day'},{label:'Week',value:'week'},{label:'Month',value:'month'}]} value="day" onValueChange={() => {}} />

See the full SegmentedControl reference →