Skip to content
Design System
GitHub

Segmented control

v0.17.3

Switch between views of the same data. The selected segment is inverted.

30 days: this robot has 12 days of history.

Segmented control default

Install
npx shadcn add @syncrobotic/segmented-control

Also installs: radix-ui, @syncrobotic/cn

Overview

Two to four buttons joined into one, for switching between views of the same data. The selected one is inverted.

When to use

  • Map / list, chart / table, day / week.
  • A filter with a few exclusive options in a toolbar.

Use something else

  • Sections of a page with different content: Tabs.
  • More than four options: Select.
  • A choice inside a form: Radio group.

More examples

States and real uses. Each example is also a Storybook story and a visual regression test.

Segmented control icon only

Segmented control three views

Year: reports keep 90 days.

Segmented control disabled item

Usage rules

  • For two to four views of the same data. For sections of a page, use Tabs.
  • The selected segment is inverted, per the selected-state rule.

Changelog

  • 0.17.32026-11-21One segment always stays selected: pressing the selected one again no longer clears the choice (it called onValueChange("")).
  • 0.17.22026-11-19In high contrast the track has an --input edge (3:1). The thumb re-measures when a segment resizes, so it never drifts off the selected segment.
  • 0.15.02026-11-19The selected thumb travels to the segment you pick (Move pattern, --motion-base); the label colour changes with it.

How to upgrade