ProductBrand
Join us
Foundations
  • Introduction
  • Colors
  • Typography
  • Icons
  • Illustrations
  • Logos
  • Shadows
Components
  • Accordion
  • Alert Dialog
  • Avatar
  • Badge
  • Button
  • Calendar
  • Card
  • Chart
  • Checkbox
  • Collapsible
  • Combobox
  • Context Menu
  • Date Picker
  • Dialog
  • Drawer
  • Dropdown Menu
  • Fluid Avatar
  • Hover Scroll Text
  • Input
  • Kbd
  • Popover
  • Progress Bar
  • Radio Group
  • Scroll Area
  • Select
  • Selectors
  • Separator
  • Separator Dot
  • Shimmer Text
  • Skeleton
  • Slider
  • Switch
  • Tabs
  • Textarea
  • Toast
  • Tooltip
Compositions
  • Empty State
  • File Attachment
  • Floating Bar
  • Input Banner
  • Markdown Editor
  • Media Controls
  • Product Feature Banner
  • Panels
  • Sidebar
  • Reasoning Trace
  • Pagination
  • Data Table
  • Breadcrumb
  • Thread Outline
Inline
  • Overview
  • Stat Tile
  • Metric Row
  • Comparison Table
  • Chart Card
  • Trend Tile
  • Cite
  • Custom
  • Agent skill

Segmented Control

A single-select pill control for rescoping a view: chart granularity, permission type, grid/list mode. It shares the track and raised active chip with Tabs variant="secondary", but it is a radiogroup, not a tablist, because nothing behind it is a panel.

Examples

Basic

7 days30 days90 days

Scope: 30d

Sizes

7 days30 days90 days
7 days30 days90 days

Animated chip

7 days30 days90 days

Icon only

Overview

tsx
import { SegmentedControl } from "@rogo-technologies/ui/segmented-control";

const RANGES = [
  { value: "7d", label: "7 days" },
  { value: "30d", label: "30 days" },
] as const;

<SegmentedControl ariaLabel="Date range" options={RANGES} value={range} onChange={setRange} />;

It wraps Base UI Radio, so roving focus, arrow-key selection, and aria-checked come from Base UI rather than hand-rolled key handlers. options is generic over your value union, so onChange hands back your own type, with no cast at the call site.

Usage

Segmented control or tabs?

Use Tabs variant="secondary" when the segments swap panels: it has the same pill treatment, plus tab semantics and an associated panel. Use SegmentedControl when the segments rescope one view that stays put: a chart's granularity, a table's filter, a page's view mode.

Animated chip

animateLayoutId slides one shared chip between segments instead of cross-fading each segment's background. The id only has to be unique among controls mounted at the same time; when a page renders responsive copies of the same control, derive it from useId().

tsx
<SegmentedControl animateLayoutId={useId()} ariaLabel="View mode" … />

Icon-only segments

iconOnly renders square segments with the icon alone and promotes each option's label to its accessible name, so the control stays screen-reader complete without visible text.

API

SegmentedControl

PropTypeDefaultDescription
valueT-Selected option value.
onChange(value: T) => void-Fired with the newly selected value.
optionsreadonly SegmentedControlOption[]-Segments, in render order.
ariaLabelstring-Names the group; required because there is no visible group label.
size"sm" | "md""md"sm fits inside a chart toolbar.
iconOnlybooleanfalseRenders each option's icon alone, with its label as accessible name.
disabledbooleanfalseDisables every segment.
animateLayoutIdstring-Slides one shared chip between segments.

SegmentedControlOption

PropTypeDescription
valueTOption value.
labelstringVisible label, or accessible name if iconOnly.
iconReact.ReactNodeRendered before the label.
disabledbooleanDisables this segment only.
testIdstringSets data-testid on the segment.

Guidelines

Do

  • Reach for it when the segments rescope a view that stays in place.
  • Keep labels to two or three short segments; more belongs in a Select.
  • Give every control an ariaLabel that names what is being scoped.

Don't

  • Don't use it to swap panels. That's Tabs variant="secondary".
  • Don't hand-roll the track and chip out of buttons; that's what this replaces.
  • Don't reuse one animateLayoutId across two simultaneously mounted controls.

Design at Rogo

We’re redesigning an entire industry. Come design it with us.

See open roles

Design at Rogo

  • How we workThe mission of design at Rogo, and the open roles
  • About RogoThe company and the product