Skip to main content

Design system components

SegmentedControl

Single-select segmented control: a compact, pill-shaped row of mutually exclusive options with one visibly selected, as a radiogroup with roving-tabindex arrow-key navigation. The selection indicator slides between options.

Status: beta. Group: form. Markdown version: /design-system/components/segmented-control.md

When to use

SegmentedControl is the single-select counterpart to ButtonGroup: a compact row of mutually exclusive options with one visibly selected, for switching a small closed set of views or modes inline without opening a menu (list/grid, day/week/month). It is controlled; value + onValueChange own the selection. Keep it to 2-5 short segments; if the options do not fit on one line, use Select. Selecting must only change the bound value, never commit or route.

When not to use

  • Do not use it for actions or navigation that commits/routes; use ButtonGroup or links. Selecting must only change the bound value.
  • Do not overflow it; if the options do not fit on one line, use Select.

Look-alikes

  • ButtonGroup: Do not use it for actions or navigation that commits/routes; use ButtonGroup or links. Selecting must only change the bound value.
  • Select: Do not overflow it; if the options do not fit on one line, use Select.

Props

SegmentedControl props
PropTypeDefaultDescriptionRequired
itemsSegmentedControlItem[]noneSegments to render, in order.Yes
valuestringnoneCurrently selected value (controlled).Yes
onValueChange(value: string) => voidnoneCalled with the new value when a segment is selected.Yes
size"sm" | "md" | "lg"mdSize token.No
ariaLabelstringnoneAccessible name for the group (required; announced by screen readers).Yes
classNamestringnoneAdditional CSS class names.No

Variants

  • Available sizes: sm, md, lg (default md).

Invalid combinations

The contract records no invalid combinations.

Keyboard

SegmentedControl keyboard behaviour
KeyBehaviour
TabMoves focus to the selected segment (roving tabindex)
Arrow Left/Up and Right/DownMove selection to the previous/next enabled segment.
Home/EndSelect the first/last enabled segment.

Rules

Every item under When not to use is a MUST NOT. MUST and SHOULD follow RFC 2119.

SegmentedControl rules
LevelRuleHow it is checked
MUSTARIA: Container is role=radiogroup with a required aria-label.Not yet verified: no evidence record. WCAG 4.1.2.
MUSTARIA: Each segment is role=radio with aria-checked reflecting selection.Not yet verified: no evidence record. WCAG 4.1.2.
MUSTARIA: Disabled segments are skipped by keyboard navigation.Not yet verified: no evidence record. WCAG 4.1.2.
MUSTRequired stories produce no axe violations at the configured severity.Automated by npm run test:stories:matrix:ci. WCAG 2.5.8.
MUSTThe accessibility tree (role, name, state) matches the committed snapshot for every required story.Automated by npm run test:stories:matrix:ci. WCAG 1.3.1, 4.1.2.
MUSTThe component remains legible and operable under a real browser forced-colors: active pass.Automated by npm run test:stories:hc.
MUSTEvery documented keyboard interaction works as specified.Not yet verified: no evidence record. WCAG 2.1.1, 2.1.2.
MUSTA human completed an end-to-end accessibility review of this component.Manual review, last on 2026-07-12.

Install and import

  • Install: npm install @digitaltableteur/react (version 0.9.1, restricted access on npm).
  • Import: import { SegmentedControl } from "@digitaltableteur/react";
  • Entry point: @digitaltableteur/react/navigation exports it too.
  • Styles: import @digitaltableteur/react/style.css once at the app boundary.
  • Also available as the custom element <dt-segmented-control>; see the custom elements manifest.