Skip to contentKino
Skip to Content

Segmented control

Pick one of a few options from a row of segments. It looks and moves like the Tabs, and a form can submit it.

npx shadcn add https://kinoui.com/r/segmented-control.json
Share on

Examples

Revenue

$76,910+11.8%

902 orders in the last 30 days

Default

The pill slides to the pick, and each label changes colour as the pill crosses it, as on the Tabs. A backdrop follows the pointer.

Notifications

Digest
Send to

In a form

Give it a name and the form sends the picked value. Give it w-full and each segment flex-1 to share the width.

Checkout v2

KN-482
Address autocomplete on the shipping step
AO
KN-479
Apple Pay sheet closes on rotation
KW
KN-471
Guest checkout copy
LF

Icon only

A segment with only an icon needs an aria-label and a square shape.

Who can see Lisbon café study

12 interviews, 3 reports.

Everyone in Research can see and edit it.

Vertical

Set orientation to vertical for a column, as beside a calendar or a setting with longer labels. The pill slides down it, and the arrow keys move either way.

Controlled

Hold the value to change it from outside. Change it again mid-slide and the pill turns from where it is.

Billing
Pick how often to bill.

Invalid

Inside a Field set invalid, it rings in the destructive colour. Here it is invalid until something is picked.

Disabled

disabled on a segment turns off that option; on the control it turns off all of them and fades the pill.

Installation

npx shadcn@latest add https://kinoui.com/r/segmented-control.json
Files
lib/reduce-motion.tslib/resize.tslib/run-progress.tslib/highlight.tslib/pill.tslib/refs.tslib/scroll.tscomponents/kino/segmented-control.tsx
Packages
@base-ui/react

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

SegmentedControl

PropTypeDefaultDescription
valuestringNoneThe picked value, when you hold the state.
defaultValuestringNoneThe value picked at first, when it holds its own state.
onValueChange(value, details) => voidNoneCalled with the new value when another segment is picked.
namestringNoneThe field’s name when it is in a <form>.
requiredbooleanfalseThe form can’t be sent until a segment is picked.
disabledbooleanfalseTurns off every segment.
orientation'horizontal''vertical''horizontal'A row, or a column whose labels line up at the start.
classNamestringNoneGoes on the track, the box you lay out.
readOnlybooleanfalseShows the value but can’t be changed.

SegmentedControlItem

PropTypeDefaultDescription
valuestringNoneThe value the control takes when this segment is picked.
disabledbooleanfalseTurns off this segment only.

Data attributes

AttributeOnDescription
data-checkedSegmentedControlItemPresent while it is picked.
data-disabledSegmentedControlItem, SegmentedControlPresent while it is disabled.
data-invalidSegmentedControlPresent while its Field is invalid.

Accessibility

  • It is a radio group: Tab moves into it at the picked segment, and the arrow keys move the pick. Use the Toggle group for buttons that turn on and off, or several at once.
  • Name it with aria-label, or with aria-labelledby pointing at its visible label.
  • A segment with only an icon needs aria-label.
  • A row wider than its column scrolls, as the Tabs do: an edge fades while segments are hidden past it, and the picked or focused segment scrolls into view.
  • In forced colours the pill takes the system highlight, and an invalid control adds a dashed outline.
  • When the system asks for less motion, the pill moves to the pick at once.