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.
Examples
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.
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
Icon only
A segment with only an icon needs an aria-label and a square shape.
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.
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- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
SegmentedControl
SegmentedControlItem
Data attributes
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 witharia-labelledbypointing 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.