Core components / Button groups
Segmented control
Two to five options side by side on a muted track; the chosen one rises as a card. For switching a view or mode in place, with labels, icons only, or counts that filter a list by status. Native radios underneath, on the same size ladder as Button so it lines up in toolbars.
MembersReact · Vue · HTMLFigma: Button groups
Code
The component itself, ready to drop into your project. Switch between React, Vue and plain HTML; every version uses the same Tailwind classes on Ochre's tokens.
Installation
Examples
With icons
Icons beside labels, then icons only with two, three and four segments.
Q3 roadmap
With counts
Filtering a list by status, with three and four segments.
Members
- Maya Shahactive
- Sam Okaforactive
- Lena Brandtinvited
- Tomás Riverapaused
- Ada Mensahactive
Sizes
Motion
Built on Ochre's ease-out curves. With reduced motion switched on, everything still works, it just doesn't move.
01The chosen card glides to the new option with an ease-out, resizing to fit its label on the way.
02Labels sink to 97% while pressed and their colour changes in 120 ms.
03On first paint the card is already in place: it only moves when the choice changes.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| options | { value: string; label: ReactNode; icon?: ReactNode; count?: ReactNode; disabled?: boolean }[] | – | The segments, in order. count adds a mono figure after the label. |
| value / defaultValue | string | – | Controlled or uncontrolled choice. |
| onValueChange | (value: string) => void | – | Called with the chosen value. |
| size | "s" | "m" | "l" | "xl" | "xxl" | "m" | 32 to 64 pixels high, matching Button. |
| fullWidth | boolean | false | Stretches the track and shares the width equally. |
| iconOnly | boolean | false | Square segments with just each option's icon; the label is read by screen readers and shown as a tooltip. |
| aria-label | string | – | Names the group for screen readers. |
Usage
Use it for
- Switching how the same content is shown: Day, Week, Month; List, Board.
- Short mode choices in toolbars and chart headers.
- Icons only for well-known views (list, board, calendar), with the label kept for screen readers.
- Counts on each segment when it filters a list by status: All 128, Active 96.
Avoid
- Navigating to different pages or content: use Tabs.
- More than five options or long labels: use a Select.
- Settings saved with a form, where a Radio group reads more clearly.