Segmented control

● Stable · v0.1

A pill-shaped switch for choosing one view among a small set — "Today" vs "This week", "Updates" vs "Details". The selected segment lifts onto a white pill so the current choice is unmistakable at a glance.

In context

9:41

Try it

Purpose

Segmented control lets a user flip between two or three views of the same screen without navigating away. It keeps the choice visible and reversible — one tap there, one tap back — which suits a low-literacy user who's exploring rather than committing.

Anatomy

  • Track — a rounded pill that holds the segments on a quiet surface.
  • Segments — equal-width options; each is at least a 44dp tap target.
  • Selection — the active segment sits on a white pill (a soft lift); its label goes bold. The rest stay quiet.

Code

import { SegmentedControl } from '@daytwo/components'
const [period, setPeriod] = useState('today')
<SegmentedControl
options={[
{ value: 'today', label: 'Today' },
{ value: 'week', label: 'This week' },
]}
value={period}
onChange={setPeriod}
/>

For Burmese labels, pass fontFamily (the Noto Sans Myanmar family) so the labels render in the right script.

When to use

  • To switch between 2–3 views of one screen (a time range, a filter, two tabs of content).
  • When both options are peers and the user benefits from seeing them side by side.

When NOT to use

  • To navigate between screens — that's a tab bar or links, not a segmented control. A segmented control implies "same screen, different slice."
  • For more than ~3 options — segments get cramped and labels truncate; use a list, dropdown, or filter chips instead.
  • For an on/off setting — use a switch.

The correct scenario

The home screen shows "Today" and "This week" as two segments above the day's number. Tapping "This week" swaps the metric in place — the owner compares the two periods in a second, without leaving home or losing their place.

Anti-patterns

Do
Two or three peer views of one screen — 'Today / This week' — with short, scannable labels.
Don't
Five crammed segments ('Day / Week / Month / Quarter / Year') — labels shrink and truncate, and it starts acting like navigation.
Two or three, no more

The white pill only reads as 'the selected one' when there's room for it. Past three segments, switch to a different control.

Edge cases

Long Burmese labels
Keep to two segments; labels wrap to one line each
WhyBurmese runs longer — three segments may not fit
Many options
Use a list or dropdown instead
WhySegments must stay tappable and readable
Default selection
Always start with one segment selected
WhyThere's no valid "nothing selected" state
Dark mode
Track and pill follow the theme surfaces
WhyThe lift stays visible in both schemes

Tokens used

color.background.secondarycolor.surface.primarycolor.text.primarycolor.text.secondaryradius.pillelevation.smtypography.callout