coss.com ui

Segmented Control

A visual pattern for presenting related choices, navigation destinations, filters, or content views.

About

A segmented control is a visual pattern, not a standalone behavior. SegmentedControl and SegmentedControlItem provide the presentation and the sliding indicator; the element you pass to render provides the semantics, keyboard interactions, and state model.

Choose the right primitive

Choose the primitive from the interaction first, then render it through the segmented control. Visual similarity alone is not a reason to use Tabs or Toggle Group.

Installation

Usage

Put behavior props such as defaultValue, value, onValueChange, or href on the element passed to render. Use the Radio Group primitives rather than RadioGroup and Radio, so the native radio indicator is not rendered.

The same composition works for navigation links:

And for an exclusive filter that may be cleared:

API Reference

SegmentedControl

The segmented surface. Renders a <div> by default and appends the sliding indicator after its children. Provides the size to its items via context.

SegmentedControlItem

A single segment. Renders a <button type="button"> by default.

An item is active when it has data-checked (Radio Group), aria-current="page" (links), or data-pressed (Toggle Group). The indicator slides to the active item over 200ms with an ease-in-out curve, stays still when the user prefers reduced motion, and is hidden when no item is active. Before hydration or without JavaScript, the active item paints its own static pill instead. For navigation, the pill animates only when the control persists across route changes, such as in a shared layout; otherwise it appears in place on each page.

At the outside edges, the item padding and the surface’s inset combine to match the horizontal padding of the corresponding Button size. The surface is slightly taller than that Button to optically balance its inset selected item when the controls appear next to each other.

Examples

Small Radio Group

Default Radio Group

Large Radio Group

Small Navigation

Default Navigation

Large Navigation

Use Tabs when each segment controls an associated content panel. Tabs keep Base UI’s own indicator and add orientation support and panel semantics, but share the segmented control’s sizes, icon layout, and indicator surface so both look the same.

Changelog

  • Oct 20, 2026 — Segmented control is now a component with a built-in sliding indicator

coss.com ui

Built by and for the team of Cal.com, Inc. — the leading commercial open source company (“coss”).