Integrated ResearchPicasso
Components

Segmented control

A choice that stays selected, as one control: two to five short options on a track, with the current one on a raised thumb.

{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}

A choice that stays selected, as one control: two to five short options on a track, with the current one on a raised thumb.

Import

import { SegmentedControl, SegmentedControlItem } from "@ir/ui";

Props

Takes the props of the element it renders, and nothing of its own — styling is the component's business, not the caller's.

Do and don't

Use a SegmentedControl when one option stays selected.

Don't — Use a ButtonGroup with one button styled as selected.

Nothing in a ButtonGroup stays pressed, so a faked selected state reads as two different buttons. The thumb on a track says one of these is the current value.

Start with one option selected.

Don't — Leave the control with nothing selected.

It is a radio group: once something is chosen there is no way back to nothing, and an empty track looks broken rather than unanswered.

Keep it to two to five short labels. Beyond that, use Select or a RadioGroup.

Don't — Put six options, or labels that need a sentence, on one track.

Every option shares one row. Past five, or with long labels, the segments get too narrow to read or the control overflows on a phone.

Use Tabs when each option shows a different panel.

Don't — Use it to switch between panels of different content.

A segmented control sets a value and is announced as a radio group. Tabs own a panel each and are announced as tabs. The two look alike and promise different things.

Give it an aria-label, or a visible label beside it: "Order", "View".

Don't — Leave the control without a name.

"Ascending, radio, 1 of 2" does not say what is being ordered. The group's name supplies it.

Accessibility

  • role="radiogroup" with role="radio" items, so it is announced as one choice with a position: "Ascending, radio, 1 of 2".
  • One tab stop. Left and Right arrows move the selection, as in any radio group.
  • It needs a name: aria-label on the control, or aria-labelledby pointing at a visible label.
  • Selection is carried by the thumb and by the label's colour, not by colour alone.

Where it is drawn

Figma — structure from code, measurements from code.

Open in Storybook

On this page