All registry items
primitives/r/tonal-segmented-control.json

Tonal Segmented Control

Accessible pill switcher with Arrow/Home/End roving keyboard navigation.

Tonal Segmented Control

Toggle Tablet or Mobile for real isolated iframe breakpoints, or switch to Code for full source.

@tonal-tokensclsxtailwind-merge

Selected range: 7d (try Left/Right arrow keys when focused)

Installation

npx shadcn@latest add https://tonal.harlo.dev/r/tonal-segmented-control.json

Dependencies

Tonal Registry Dependencies
npm Packages
clsxtailwind-merge

Usage

import { TonalSegmentedControl } from "@/components/tonal/segmented-control";

<TonalSegmentedControl
  value={range}
  onValueChange={setRange}
  options={[{ value: "7d", label: "7D" }, { value: "30d", label: "30D" }]}
/>

Props & Tokens API

PropTypeDefaultDescription
optionsSegmentedOption<T>[]—List of values, labels, optional icons & badges.
valueT—Controlled active option.
defaultValueT—Initial uncontrolled active option.
onValueChange(value: T) => void—Fires on click or arrow-key selection.
size"sm" | "md""md"Compact or regular pill density.