<!-- generated by scripts/gen-docs.mjs from docs/system/segmented-control.md. Edit the source and rerun. -->
# SegmentedControl

## Description
Chooses one of a few fixed options, as a radio group that changes state in place or as links that change the URL.

`import { SegmentedControl, type Segment } from "@/components/cobalt/ui/segmented-control"`, source `registry/cobalt/ui/segmented-control.tsx`, status `ready-with-gaps`.
Foundation: `Base UI RadioGroup and Radio, team component`. Traps checked: `trap/tabs-routes` (Usage, `rule/segmented-control-links-for-url-state`: the URL case is links, not a tablist), `trap/current-unmarked` (ARIA: `aria-checked` on the choice, `aria-current` on the link), `trap/weight-shift` (States, checked: both states are weight 500, measured 0px width change on every item and the track after a pick), `trap/control-height` (States, default: items are 28px in a 4px padded track, so the track is 36px, the same as `--control`), `trap/focus-ring-shape` (States, focus-visible: the global outline follows the round item), `trap/hover-beats-focus` (State precedence), `trap/disabled-still-hovers` (n/a, the component takes no disabled prop), `trap/motion-restart` (Motion: the thumb's transition retargets from where it is), `trap/motion-layout-property` (Motion: transform and width, the width being the one measured property, under D17), `trap/reduced-motion-ignored` (Motion: the thumb jumps and the label colour still changes), `trap/list-dead-gap` (States, default: the 4px gap between items belongs to the track, so a press in it does nothing by design and the hover state ends at the item), `trap/narrow-hidden-nav` (Limits, `rule/segmented-control-max-options`), `trap/toggle-switch-submit` and `trap/toggle-indeterminate` (n/a, Toggles traps for a control with exactly one choice on).

### Foundation
| Given by the foundation | Added by the team |
|---|---|
| Base UI `RadioGroup` with `value` and `onValueChange`, roving focus and the arrow keys; `Radio.Root` as a native `<button type="button">` through `nativeButton` and `render`, with `role="radio"` and `aria-checked` | The one API for both jobs: `label`, `value`, `options` of `{ value, label, icon?, href? }`; with `onChange` the radio group, without it a `role="group"` of anchors with `aria-current` on the choice, drawn by `renderLink` (D5); the thumb (`--thumb`, the card in the light and a step above the track in the dark, with `shadow-glass`), the look Tabs and Fund Census use, one span measured from the checked or current item and slid by `useIndicator` on the settle spring (D15, D17), first in the track so items paint over it; a mouse or a pen picks on press and a touch on lift, the pressed label in ink from touchdown (`pressToChoose`, shared with Tabs); one weight, 500, for every label, so a pick changes no width (D37); options 28px tall (`min-h-7`, an icon option `size-7`) with 12px of side padding, the Tabs trigger's and Button's, inside a track with 4px of padding (`p-1`), which makes the track 36px, the same height as a button or a field in the same row (`rule/layout-one-control-height`); the track `--r-track` and the thumb and options `--r-thumb`, the track's corner less its 4px of padding (D38); `fill` stretches the track to its container (`w-full`) and gives every option `flex-1`, so the choices split it equally; no press fill, the label turning to ink instead; icons in place of words with the word kept as `aria-label` and a Tooltip; `touch-target` on every item; no ring `max-w-full` on the track and wrapping labels (`text-center`, no `nowrap`), so long translated choices wrap at their spaces inside each choice instead of running past the container (`docs/research/2026-10-16-break-ui-inputs.md`). |

## Examples
A radio group with one tab stop above the list it narrows; arrows move the choice, and the list answers at once.

Real uses, 4 call sites (`rg -n "<SegmentedControl\b" app registry docs/system/examples --glob '!registry/cobalt/ui/*' --glob '!docs/system/examples/**'`):
- The showcase header's theme switch, three icon choices as a radio group in the `glass` variant, `app/shell.tsx:83-85`.
- The development-only stress page's bar, three link-mode tracks for the dataset, the width and the text direction, `app/stress/harness.tsx:94`, `app/stress/harness.tsx:104`, `app/stress/harness.tsx:114`.

Uses inside the registry: none.

### Example files
| File | Covers | Caption |
|---|---|---|
| `docs/system/examples/segmented-control/default.tsx` | default | A radio group with one tab stop above the list it narrows; arrows move the choice, and the list answers at once |
| `docs/system/examples/segmented-control/default.tsx` | mode=buttons | A radio group with one tab stop; arrows move the choice |
| `docs/system/examples/segmented-control/mode-links.tsx` | mode=links | Each choice is a link to the same page with the choice in its address, so it survives a reload and can be shared |
| `docs/system/examples/segmented-control/options-icon.tsx` | options=icon | Icons, each named by its word for the tooltip and the screen reader |
| Not applicable: the choice that is on is in every example, the white thumb under its label | state:checked | `aria-checked="true"` or `aria-current="true"`, the label in `--foreground` |
| Not applicable: hover is reached with the pointer on any example | state:hover | The label of an unchosen item turns to `--foreground` |
| Not applicable: focus-visible is reached with the keyboard on any example | state:focus-visible | The 2px outline 2px outside the round item |
| Not applicable: pressed is the label turning to ink while the pointer is down on any example | state:pressed | The label in `--foreground`; no fill, since the thumb is the only fill |
| `docs/system/examples/segmented-control/variant-track.tsx` | variant=track | The grey track with a white thumb, for a choice inside a page, a panel or a form |
| `docs/system/examples/segmented-control/variant-glass.tsx` | variant=glass | In a bar beside a nav, the choice is the nav's own pill |
| `docs/system/examples/segmented-control/fill.tsx` | fill=true | With fill, the track takes the width of a narrow panel and each choice an equal share |
| `docs/system/examples/segmented-control/in-section.tsx` | composition:Section | Beside a section heading, above what it changes |

Example: A radio group with one tab stop above the list it narrows; arrows move the choice, and the list answers at once (`docs/system/examples/segmented-control/default.tsx`)

```tsx
import { useState } from "react";

import { SegmentedControl } from "@/components/cobalt/ui/segmented-control";
import { Presence, PresenceRow } from "@/lib/cobalt/presence";

type Range = "week" | "month" | "year";

const days: Record<Range, number> = { week: 7, month: 30, year: 365 };

const filings = [
  { fund: "Northgate Credit", daysAgo: 2 },
  { fund: "Harbor Lane Partners", daysAgo: 6 },
  { fund: "Elm Street Value", daysAgo: 19 },
  { fund: "Westbrook Income", daysAgo: 27 },
  { fund: "Saltmarsh Capital", daysAgo: 140 },
  { fund: "Ridgeview Growth", daysAgo: 301 },
];

// Every choice narrows the rows already loaded, so the list answers at once: rows that go leave and
// rows that come grow in, so the list's height moves and nothing under it jumps.
export default function Example() {
  const [range, setRange] = useState<Range>("month");
  const shown = filings.filter((filing) => filing.daysAgo <= days[range]);
  return (
    <div className="flex w-full max-w-md flex-col gap-3">
      <div className="flex flex-wrap items-center justify-between gap-3">
        <p className="text-sm font-medium tabular-nums">{shown.length} filings</p>
        <SegmentedControl
          label="Range"
          value={range}
          onChange={setRange}
          options={[
            { value: "week", label: "Week" },
            { value: "month", label: "Month" },
            { value: "year", label: "Year" },
          ]}
        />
      </div>
      <ul className="flex flex-col text-sm">
        <Presence>
          {shown.map((filing) => (
            <PresenceRow key={filing.fund}>
              <div className="flex justify-between gap-3 py-1">
                <span className="min-w-0 wrap-break-word">{filing.fund}</span>
                <span className="shrink-0 text-muted-foreground tabular-nums">{filing.daysAgo} days ago</span>
              </div>
            </PresenceRow>
          ))}
        </Presence>
      </ul>
    </div>
  );
}
```

Example: Beside a section heading, above what it changes (`docs/system/examples/segmented-control/in-section.tsx`)

```tsx
import { useState } from "react";

import { Section } from "@/components/cobalt/ui/section";
import { SegmentedControl } from "@/components/cobalt/ui/segmented-control";

type Range = "week" | "month";

export default function Example() {
  const [range, setRange] = useState<Range>("week");
  return (
    <Section
      id="example-segmented-section"
      heading="Attendance"
      controls={
        <SegmentedControl
          label="Range"
          value={range}
          onChange={setRange}
          options={[
            { value: "week", label: "Week" },
            { value: "month", label: "Month" },
          ]}
        />
      }
    >
      <p className="text-sm text-muted-foreground">
        {range === "week" ? "Forty people came this week." : "One hundred and sixty people came this month."}
      </p>
    </Section>
  );
}
```

## Variants
### variant
- `track`: the default, a grey track with a white thumb, for a choice inside a page, a panel or a form. Used at 1 call site in the showcase, the stress page's bar, `app/stress/harness.tsx:94`.
- `glass`: no track, and the choice drawn as the nav's glass pill, 36px tall with the control corner (`--r-control`), for a control that sits in a bar beside a `Nav`, so the bar marks a choice one way. Used at 1 call site, the showcase header's theme switch, `app/shell.tsx:83`.

Its two modes follow from `onChange` (a radio group) or its absence (links), and its two looks from `icon` on each option; the examples table covers each.

Example: A radio group with one tab stop; arrows move the choice (`docs/system/examples/segmented-control/default.tsx`)

```tsx
import { useState } from "react";

import { SegmentedControl } from "@/components/cobalt/ui/segmented-control";
import { Presence, PresenceRow } from "@/lib/cobalt/presence";

type Range = "week" | "month" | "year";

const days: Record<Range, number> = { week: 7, month: 30, year: 365 };

const filings = [
  { fund: "Northgate Credit", daysAgo: 2 },
  { fund: "Harbor Lane Partners", daysAgo: 6 },
  { fund: "Elm Street Value", daysAgo: 19 },
  { fund: "Westbrook Income", daysAgo: 27 },
  { fund: "Saltmarsh Capital", daysAgo: 140 },
  { fund: "Ridgeview Growth", daysAgo: 301 },
];

// Every choice narrows the rows already loaded, so the list answers at once: rows that go leave and
// rows that come grow in, so the list's height moves and nothing under it jumps.
export default function Example() {
  const [range, setRange] = useState<Range>("month");
  const shown = filings.filter((filing) => filing.daysAgo <= days[range]);
  return (
    <div className="flex w-full max-w-md flex-col gap-3">
      <div className="flex flex-wrap items-center justify-between gap-3">
        <p className="text-sm font-medium tabular-nums">{shown.length} filings</p>
        <SegmentedControl
          label="Range"
          value={range}
          onChange={setRange}
          options={[
            { value: "week", label: "Week" },
            { value: "month", label: "Month" },
            { value: "year", label: "Year" },
          ]}
        />
      </div>
      <ul className="flex flex-col text-sm">
        <Presence>
          {shown.map((filing) => (
            <PresenceRow key={filing.fund}>
              <div className="flex justify-between gap-3 py-1">
                <span className="min-w-0 wrap-break-word">{filing.fund}</span>
                <span className="shrink-0 text-muted-foreground tabular-nums">{filing.daysAgo} days ago</span>
              </div>
            </PresenceRow>
          ))}
        </Presence>
      </ul>
    </div>
  );
}
```

Example: Each choice is a link to the same page with the choice in its address, so it survives a reload and can be shared (`docs/system/examples/segmented-control/mode-links.tsx`)

```tsx
import { useState } from "react";

import { SegmentedControl } from "@/components/cobalt/ui/segmented-control";
import { date } from "@/lib/cobalt/format";
import type { LinkProps } from "@/lib/cobalt/link";

type Sort = "newest" | "oldest";

const filings = [
  { fund: "Northgate Credit", filed: "2026-10-14" },
  { fund: "Harbor Lane Partners", filed: "2026-10-09" },
  { fund: "Elm Street Value", filed: "2026-09-30" },
];

export default function Example() {
  const [sort, setSort] = useState<Sort>("newest");
  // A router's link would do this: read the choice from the URL. Here the click sets it in place.
  function renderLink({ href, children, ...props }: LinkProps) {
    return (
      <a
        {...props}
        href={href}
        onClick={(event) => {
          event.preventDefault();
          setSort(href.endsWith("oldest") ? "oldest" : "newest");
        }}
      >
        {children}
      </a>
    );
  }
  const shown = sort === "newest" ? filings : [...filings].reverse();
  return (
    <div className="flex w-full max-w-sm flex-col gap-3">
      <SegmentedControl
        label="Sort"
        value={sort}
        renderLink={renderLink}
        options={[
          { value: "newest", label: "Newest", href: "?sort=newest" },
          { value: "oldest", label: "Oldest", href: "?sort=oldest" },
        ]}
      />
      <ul className="flex flex-col gap-2 text-sm">
        {shown.map((filing) => (
          <li key={filing.fund} className="flex justify-between gap-3">
            <span className="min-w-0 wrap-break-word">{filing.fund}</span>
            <span className="shrink-0 text-muted-foreground tabular-nums">{date(filing.filed)}</span>
          </li>
        ))}
      </ul>
    </div>
  );
}
```

Example: Icons, each named by its word for the tooltip and the screen reader (`docs/system/examples/segmented-control/options-icon.tsx`)

```tsx
import { useState } from "react";

import { LayoutGridIcon, ListIcon } from "@/components/cobalt/icon";
import { SegmentedControl } from "@/components/cobalt/ui/segmented-control";
import { TooltipProvider } from "@/components/cobalt/ui/tooltip";
import { cn } from "@/lib/cobalt/utils";

type View = "list" | "grid";

const rooms = [
  { name: "Harbour room", seats: 12 },
  { name: "Library", seats: 6 },
  { name: "Long table", seats: 20 },
  { name: "Garden studio", seats: 8 },
];

export default function Example() {
  const [view, setView] = useState<View>("list");
  return (
    <TooltipProvider>
      <div className="flex w-full max-w-sm flex-col gap-3">
        <SegmentedControl
          label="View"
          value={view}
          onChange={setView}
          options={[
            { value: "list", label: "List", icon: ListIcon },
            { value: "grid", label: "Grid", icon: LayoutGridIcon },
          ]}
        />
        <ul className={cn("text-sm", view === "grid" ? "grid grid-cols-2 gap-2" : "flex flex-col gap-2")}>
          {rooms.map((room) => (
            <li
              key={room.name}
              className={cn(
                "flex justify-between gap-3",
                view === "grid" && "flex-col gap-0.5 rounded-2xl bg-muted p-3",
              )}
            >
              <span className="min-w-0 wrap-break-word">{room.name}</span>
              <span className="shrink-0 text-muted-foreground tabular-nums">{room.seats} seats</span>
            </li>
          ))}
        </ul>
      </div>
    </TooltipProvider>
  );
}
```

Example: The grey track with a white thumb, for a choice inside a page, a panel or a form (`docs/system/examples/segmented-control/variant-track.tsx`)

```tsx
import { useState } from "react";

import { SegmentedControl } from "@/components/cobalt/ui/segmented-control";

type Unit = "count" | "share";

const domiciles = [
  { name: "Cayman Islands", funds: 46 },
  { name: "Delaware", funds: 38 },
  { name: "Ireland", funds: 16 },
];
const total = domiciles.reduce((sum, d) => sum + d.funds, 0);

export default function Example() {
  const [unit, setUnit] = useState<Unit>("count");
  return (
    <div className="flex w-full max-w-xs flex-col gap-3">
      <SegmentedControl
        label="Show"
        value={unit}
        onChange={setUnit}
        options={[
          { value: "count", label: "Funds" },
          { value: "share", label: "Share" },
        ]}
      />
      <ul className="flex flex-col gap-1 text-sm">
        {domiciles.map((d) => (
          <li key={d.name} className="flex justify-between gap-3">
            <span>{d.name}</span>
            <span className="text-muted-foreground tabular-nums">
              {unit === "count" ? d.funds : `${Math.round((d.funds / total) * 100)}%`}
            </span>
          </li>
        ))}
      </ul>
    </div>
  );
}
```

Example: In a bar beside a nav, the choice is the nav's own pill (`docs/system/examples/segmented-control/variant-glass.tsx`)

```tsx
import { useState } from "react";

import { MonitorIcon, MoonIcon, SunIcon } from "@/components/cobalt/icon";
import { Nav } from "@/components/cobalt/ui/nav";
import { SegmentedControl } from "@/components/cobalt/ui/segmented-control";
import { TooltipProvider } from "@/components/cobalt/ui/tooltip";

type Theme = "system" | "light" | "dark";

export default function Example() {
  const [theme, setTheme] = useState<Theme>("system");
  return (
    <TooltipProvider>
      <div className="flex w-full items-center justify-between gap-3 rounded-2xl bg-card px-4 py-3">
        <Nav
          label="Sections"
          activeKey="funds"
          items={[
            { key: "home", label: "Home", href: "#home" },
            { key: "funds", label: "Funds", href: "#funds" },
          ]}
        />
        <SegmentedControl
          label="Theme"
          variant="glass"
          value={theme}
          onChange={setTheme}
          options={[
            { value: "system", label: "Match the device", icon: MonitorIcon },
            { value: "light", label: "Light", icon: SunIcon },
            { value: "dark", label: "Dark", icon: MoonIcon },
          ]}
        />
      </div>
    </TooltipProvider>
  );
}
```

Example: With fill, the track takes the width of a narrow panel and each choice an equal share (`docs/system/examples/segmented-control/fill.tsx`)

```tsx
import { useState } from "react";

import { SegmentedControl } from "@/components/cobalt/ui/segmented-control";

type Measure = "bookings" | "nights";

const week = [
  { room: "Harbour room", bookings: 9, nights: 21 },
  { room: "Garden room", bookings: 6, nights: 17 },
  { room: "Library", bookings: 4, nights: 4 },
];

export default function Example() {
  const [measure, setMeasure] = useState<Measure>("bookings");
  return (
    <div className="flex w-72 max-w-full flex-col gap-3">
      <SegmentedControl
        fill
        label="Measure"
        value={measure}
        onChange={setMeasure}
        options={[
          { value: "bookings", label: "Bookings" },
          { value: "nights", label: "Nights" },
        ]}
      />
      <ul className="flex flex-col gap-1 text-sm">
        {week.map((row) => (
          <li key={row.room} className="flex justify-between gap-3">
            <span>{row.room}</span>
            <span className="text-muted-foreground tabular-nums">{row[measure]}</span>
          </li>
        ))}
      </ul>
    </div>
  );
}
```

## States
| State | Trigger | What the user can do | Shown by, besides color | Checked by |
|---|---|---|---|---|
| default | render | press an item, focus the group | the grey track 36px tall, with 28px items 4px apart inside 4px of padding; the white thumb under the current choice | screenshot |
| checked | `value` matches the option, after a press or an arrow key | press another item | the white thumb measured to the item, the label in `--foreground` at the same weight 500, `aria-checked="true"` or `aria-current="true"` | test |
| hover | pointer over an unchosen item | press | the label turns from `--muted-foreground` to `--foreground`, no fill and no shape change | by hand |
| focus-visible | keyboard focus, one tab stop on the checked item | arrows move the choice, Space picks | the 2px outline 2px outside the round item | by hand |
| pressed | pointer down | let go, or drag off | a mouse or a pen picks the item on press, so the thumb starts toward it under the press and the release does nothing more; a touch marks the item `data-pressing` and its label turns to `--foreground` at once, and the pick waits for the lift, so a scroll that starts on the control cancels it; no fill, so the only fill that moves is the thumb (measured on the docs: the thumb starts 25 to 36ms after a mouse press, the label inks from touchdown, `.design-system/evidence/segmented-control/fixin-seg-mouse-1440.png`) | by hand |
| icon | `icon` on the option | the same, plus hover or focus for the tooltip | a 28px square with a 16px glyph, the word in a Tooltip and in `aria-label` | test |
| fill | `fill` | the same | the track as wide as its container, each item `flex-1`, so the choices are equal shares and the thumb is as wide as one share | screenshot |
| link | no `onChange` | follow the link, open it in a new tab | anchors with `href`, `aria-current="true"` on the choice, `role="group"` | test |

### State precedence
- Checked and hover: both show the same colour. The chosen label is already `--foreground`, the hover colour, so hovering it changes nothing.
- Hover and focus-visible: both show. The outline is drawn outside the item and the label colour inside it.
- Checked and focus-visible: both show. The outline sits around the thumb.
- Pressed and hover: both show the same colour, `--foreground` on the label.
- Pressed and checked: Not applicable for a mouse, whose press picks the item; a touch on the checked item inks a label that is already ink.
- Checked and no match: Not applicable: when `value` matches no option, the thumb hides with `opacity: 0` and no item is checked, which `rule/segmented-control-value-matches` forbids.
- Disabled and anything: Not applicable: the component takes no `disabled` prop.

### Motion
| Trigger | Kind | Preset | Properties | Reduced motion |
|---|---|---|---|---|
| the choice changes | announce | `duration-settle ease-settle` (`--t-settle`, 300ms, on `--curve-settle`, the settle spring), through `useIndicator`, the same travel as the Tabs thumb; a control pressed this often answers in 300ms, 90 percent of the way by about 120ms; not on first paint, resize or font swap | transform (translateX) and width on the thumb | the thumb jumps to the new choice; `base.css` drops transform and width transitions and keeps the label colour change |
| pointer down, touch | input | `transition-colors` on `--t-press` from `data-pressing` | color on the label | the same colour change |
| pointer over and out | announce | `transition-colors` on `--t-press` | color on the label | the same colour change |

## Props

<!-- Props generated from registry/cobalt/ui/segmented-control.tsx with TypeScript by scripts/props-table.mjs -->
| Prop | Type | Default | Purpose |
|---|---|---|---|
| `label` | `string` |  |  |
| `options` | `readonly Segment<Value>[]` |  |  |
| `value` | `Value` |  |  |
| `className?` | `string` |  |  |
| `fill?` | `boolean` | `false` | Stretches the track to its container and splits it into equal choices, for a form or a panel. |
| `onChange?` | `(value: Value) => void` |  |  |
| `renderLink?` | `RenderLink` |  |  |
| `variant?` | `"track" \| "glass"` | `"track"` | `track`, the grey track with a white thumb; `glass`, no track and the nav's pill, for a bar. |

`label` names the group for a screen reader and is required. `value` is the chosen option's value and must match one option. `options` is a readonly list of `Segment`: `value`, `label` (always the accessible name), `icon` to draw the glyph instead of the word, `href` for link mode. Either `onChange` (a radio group) or `renderLink` (links through the host's router, D5) may be given, never both; the type forbids the pair. `fill` (default false) stretches the track to the width of its container and splits it into equal choices, for a form or a narrow panel; without it the track is as wide as its choices (`w-fit`). `className` lands on the track and is for placement.

## Usage

### When to use
- You pick exactly one of 2 to 4 fixed options and the choice shows at once: a range, a view, a sort, a theme.
- The options are peers that fit on one line at 390px, each one word.

### When not to use
- The choice switches panels of content below it. Use Tabs instead.
- The choice is where you are in the app. Use Nav or NavTabs instead.
- There are more than 4 options, or their labels run past 9 characters. Use Select instead.
- The control is on or off. Use Switch or Pill instead.
- Any number of options may be on at once. Use Checkbox, or a row of Pills, instead.

### Rules
- `rule/segmented-control-links-for-url-state`: When the choice lives in the URL, such as a view or a sort that must survive a reload and be linkable, give each option an `href` and leave `onChange` off, and when the choice is local state give `onChange` and no `href`, because links give the browser the history and the reload, and a radio group gives one tab stop and the arrow keys. Evidence: single use app/shell.tsx:86-88, the one real use keeps the theme in the page's theme store, not the URL, and uses `onChange`, and the links case is the example `docs/system/examples/segmented-control/mode-links.tsx:40`; principle platform: an anchor navigates and a radio changes a value. Check: lint the props type, which forbids `onChange` with `renderLink` so `pnpm typecheck` fails the pair; test `segmented-control.test.tsx` renders anchors with `aria-current` without `onChange` and radios with it.
  - Don't: `<SegmentedControl label="Sort" value={sort} onChange={(next) => navigate(\`?sort=${next}\`)} options={sorts} />`
  - Do: `<SegmentedControl label="Sort" value={sort} options={sorts.map((s) => ({ ...s, href: \`?sort=${s.value}\` }))} renderLink={RouterLink} />`
- `rule/segmented-control-icons-keep-words`: When options are drawn as icons, keep each option's `label` as its word and render the control inside a `TooltipProvider`, because the word is the accessible name and the tooltip, and a square with no word is announced as "radio" alone. Evidence: single use app/shell.tsx:15-17, the one real use draws icons and keeps a word on each; principle wcag: 4.1.2 Name, role, value. Check: lint the `Segment` type, on which `label` is required; test `segmented-control.test.tsx` "an icon choice keeps its word".
  - Don't: `options={[{ value: "list", label: "", icon: ListIcon }]}`
  - Do: `options={[{ value: "list", label: "List", icon: ListIcon }]}` inside `<TooltipProvider>`
- `rule/segmented-control-value-matches`: When the control renders, `value` equals the `value` of exactly 1 option, because the thumb is measured from the checked item and with none it hides, so the control shows no choice at all. Evidence: principle platform: a radio group always has one checked radio; single use app/shell.tsx:86, the one real use reads `value` from the theme store, typed by the same `ThemeChoice` as its options. Check: lint the `value` type, which is the option values; review of every `value` that comes from a URL or storage, with a fallback.
  - Don't: `<SegmentedControl label="View" value={params.get("view") ?? ""} options={views} onChange={setView} />`
  - Do: `<SegmentedControl label="View" value={params.get("view") === "agent" ? "agent" : "human"} options={views} onChange={setView} />`
- `rule/segmented-control-above-what-it-changes`: When the control switches a view or a range, place it in the bar or the Section `controls` slot above the content it changes, at the end of the row, instead of below the content or inside it, because you read the choice before the result and the thumb marks what the content shows. Evidence: single use app/shell.tsx:83, the one real use sits in the chrome above the page; principle heuristic: visibility of system status, the current view is named where the view starts. Check: review.
  - Don't: `<List items={items} /><SegmentedControl label="View" value={view} onChange={setView} options={views} />`
  - Do: `<Section heading="Attendance" controls={<SegmentedControl label="Range" value={range} onChange={setRange} options={ranges} />}>...</Section>`
- `rule/segmented-control-one-per-row`: When two choices sit on one screen, give each its own row or bar end, with at most 1 segmented control per row at 390px, because two tracks of 3 options are 416px wide together with the gap and one leaves the viewport. Evidence: measured 207.9px for 3 options of 6 characters at 390, .design-system/evidence/segmented-control/grow-count-390.json; single use app/shell.tsx:82-83, the one real use is alone in its row. Check: probe `.design-system/scripts/grow-selection.mjs` at 390; review.
  - Don't: `<div className="flex gap-2"><SegmentedControl label="Range" ... /><SegmentedControl label="View" ... /></div>`
  - Do: `<div className="flex flex-col gap-4"><SegmentedControl label="Range" ... /><SegmentedControl label="View" ... /></div>`

### Content
- Follows `rule/writing-heading-sentence-case`.
- `rule/segmented-control-option-is-one-word`: When an option is labelled, write one word in sentence case naming the choice, such as "Month" or "Agent", at most 9 characters, and no verb, because the options are read as a set of peers and the 4-option limit is measured with a 6-character word. Evidence: app 3/3 option labels at the 1 call site are one word of 4 to 6 characters (`app/shell.tsx:15-17`); measured 4 options of "System" fit at 390 with 61px to spare, .design-system/evidence/segmented-control/grow-count-390.json. Check: lint rule/ban-uppercase (scripts/check-system.mjs); review.
  - Don't: `options={[{ value: "week", label: "Show this week" }, { value: "month", label: "Show this month" }]}`
  - Do: `options={[{ value: "week", label: "Week" }, { value: "month", label: "Month" }]}`

### Anti-slop
- `rule/segmented-control-not-buttons`: When an agent builds a view switch from a row of `Button`s whose variant flips on the chosen one, or from a toggle group, use `SegmentedControl` instead, because one choice among several is a radio group with one tab stop, and the thumb is the one selection indicator. Evidence: person D31; person D17. Check: review; lint rule/ban-uppercase catches the usual "LIST" and "GRID" labels that come with it.
  - Don't: `<Button variant={view === "list" ? "default" : "ghost"} onClick={() => setView("list")}>List</Button>`
  - Do: `<SegmentedControl label="View" value={view} onChange={setView} options={[{ value: "list", label: "List" }, { value: "grid", label: "Grid" }]} />`
- `rule/segmented-control-no-shadow-or-ring`: When an agent gives the track a shadow or a border, or the thumb a ring or a heavier shadow, pass no such `className` and keep the flat track with the white thumb and its `shadow-glass` edge, because a segmented control is a flat control and the thumb's faint edge is the only depth it carries. Evidence: person D11; person D18. Check: lint rule/component-override on SegmentedControl (scripts/check-system.mjs).
  - Don't: `<SegmentedControl className="shadow-floating ring-1 ring-border" label="Range" value={range} onChange={setRange} options={ranges} />`
  - Do: `<SegmentedControl label="Range" value={range} onChange={setRange} options={ranges} />`
- `rule/segmented-control-accent-is-not-selection`: When an agent paints the chosen item in `--primary` or in the ink, keep the white thumb, because the segmented control and Tabs share one look for picking one of several, the ink is for a filter that is on, and the accent is for the view's one primary action. Evidence: person D18; person D13; principle heuristic: consistency and standards, Fund Census draws its segmented control as a white thumb on a grey track. Check: lint rule/component-override on SegmentedControl (scripts/check-system.mjs); review.
  - Don't: `<SegmentedControl className="[&_[data-slot=segmented-control-indicator]]:bg-primary" label="Range" value={range} onChange={setRange} options={ranges} />`
  - Do: `<SegmentedControl label="Range" value={range} onChange={setRange} options={ranges} />`

### Limits
- `rule/segmented-control-max-options`: When a choice has more than 4 options, use Select instead of SegmentedControl, because at 5 options with the longest real label, "System", the track runs 410px wide and leaves the 390px viewport, with nothing on screen saying more is there. Evidence: measured overflow at 5 options (right edge 410 > 390) in the showcase's 310px column at 390, with 4 options ending at 329, .design-system/evidence/segmented-control/grow-count-390.json; single use app/shell.tsx:15-17, the one real use has 3 options. Check: probe `.design-system/scripts/grow-selection.mjs` at 390; review of the option count in review.
  - Don't: `<SegmentedControl label="Range" value={range} onChange={setRange} options={[day, week, fortnight, month, year]} />`
  - Do: `<Select value={range} onValueChange={setRange} items={[day, week, fortnight, month, year]} />`

- `rule/segmented-control-fits-translated`: When the choices are translated, check that their longest words fit side by side in a 320px screen, and use Select instead when they do not, because a choice wraps only at its spaces, never inside a word, so four German ranges ("Diese Woche", "Dieser Monat", "Dieses Jahr", "Benutzerdefinierter Zeitraum") need about 390px and run past a 272px column. Evidence: measured on the stress page at 320 with the worst data, two-choice tracks wrapped inside their choices and the four-choice track ran past the column, `docs/research/2026-10-16-break-ui-inputs.md`. Check: probe the stress page `/stress/segmented-control?data=worst&width=320` with each shipped locale's labels; review of every translated SegmentedControl.
  - Don't: `<SegmentedControl label="Zeitraum" value={range} onChange={setRange} options={[week, month, year, custom]} />` on a phone in German
  - Do: `<Select value={range} onValueChange={setRange} items={[week, month, year, custom]} />`

## Accessibility
Rests on Base UI `RadioGroup` and `Radio.Root` as native buttons in button mode; on a `role="group"` of anchors in link mode.

Contrast, measured on the showcase on 16 October 2026 (.design-system/tmp/fix-actions/seg.mjs): the chosen label on the thumb 19.8:1 light and 17.18:1 dark; an unchosen label on the track 5.17:1 light and 5.86:1 dark. The thumb against the track is 1.16:1 light and 1.18:1 dark, under the 3:1 of WCAG 1.4.11, so the thumb is not the only cue: the chosen label is `--foreground` and the others `--muted-foreground`, and `aria-checked` or `aria-current` carries the state.

### Keyboard
| Key | Where focus is | Effect | Focus after | Checked by |
|---|---|---|---|---|
| Tab | before the group, button mode | focuses the checked item; the group is one tab stop | the checked item | by hand |
| Right Arrow or Down Arrow | an item, button mode | checks the next item and moves the thumb; wraps at the end | the next item | by hand |
| Left Arrow or Up Arrow | an item, button mode | checks the previous item; wraps at the start | the previous item | by hand |
| Space | an item, button mode | checks it, if not already | the item | by hand |
| Enter | an item, button mode | nothing; Base UI blocks it so a form does not submit | the item | by hand |
| Tab | a link, link mode | moves to the next link; each link is its own tab stop | the next link | by hand |
| Enter | a link, link mode | follows the `href` | the new page, or the same page with the new query | by hand |

### ARIA
| Part | Role | Accessible name from | States and properties | Announced | Checked by |
|---|---|---|---|---|---|
| track, button mode | radiogroup | `label` through `aria-label` | none | the group name on entry, then the item | test |
| item, button mode | radio | its word, or `aria-label` from `label` on an icon item | `aria-checked`, `type="button"` | the word, "radio button", checked or not, "1 of 3" | test |
| track, link mode | group | `label` through `aria-label` | none | the group name on entry | test |
| item, link mode | link | its word, or `aria-label` from `label` on an icon item | `href`, `aria-current="true"` on the choice | the word, "link", and "current" on the choice | test |
| thumb | none | none, `aria-hidden` | `data-slot="segmented-control-indicator"` | nothing | test |
| tooltip, icon items | tooltip | the option's word | shown on hover and focus | the word, once, when the item takes focus | by hand |

## Tokens
| Part | State | Token |
|---|---|---|
| track | all | `--muted`, `--r-track`, `--touch`; 36px tall from 28px options and 4px of padding, the value of `--control` |
| thumb | all | `--thumb`, `--r-thumb`, `--elev-glass` through `shadow-glass`, `--t-settle`, `--curve-settle` |
| item | all | weight 500 (`font-medium`), `--r-thumb`, 28px tall |
| item | checked | `--foreground` |
| item | unchecked | `--muted-foreground` |
| item | hover | `--foreground` |
| item | pressed, hover | `--foreground`, `--t-press`, `--curve` |
| item | focus-visible | `--ring`, `--line-focus`, `--focus-offset` |

## Related
- Tabs: views of one thing, switched in place, with the same white thumb.
- Nav and NavTabs: where you are in the app.
- Select: one of more than 4 options.
- Pill: a filter that is on or off.
- Switch: a setting that is on or off.
- Checkbox: one choice that is on or off, or stands for a set that is partly on.
- ChipRow: narrows a list to one of any number of choices.
- DropdownMenu: offers the commands for one thing from a trigger, one of them chosen and the menu gone.
- Input: takes one line of typed text.
- Toggle: keeps a tool pressed or not, such as bold in a toolbar or "Show archived" beside a list.
- Calendar: a day or a range, not a named period.
- DatePicker: a day in a form field.
- Pagination: pages of one long list, moved with Previous and Next.
- RadioGroup: one choice among options that need a description, saved with a form.
- EmojiPicker: finds an emoji by name or group and picks it, with a keyboard grid, a recent row and skin tones.
- FilterBar: filter pills over a list, each naming what is chosen, that fold into one sheet on a phone.
- NumberField: a count or an amount with a minus and a plus inside the field.
