Pick one value as a form control on Radix RadioGroup: a raised thumb in a sunken track stretches to the new option, with name, required and invalid built in.
Click meTap me
Billing
Team plan · 8 seats
Billing period
Currency
$80per month
$960 billed on 1 Dec, saving $192 a year.
segmented-control · , lively
segmented-control-demo.tsx
When to use
Use to choose one value out of two to five. It is a form control with name, required and invalid, so it submits with the form. Presets: pill, card, detail.
When not to use
If each option shows a different panel of content use Tabs. For longer lists use Radio Group or Combobox.
Choose one value out of two to five: billing period, currency, density, theme, visibility. It is a radio group drawn as a physical switch, so it behaves like any form field: it has a name, submits with the form, can be required and shows an invalid state. The value takes effect wherever you use it (a price, a preview, a saved setting); the control itself never owns content. For a long list of choices, use a select or a combobox.
If each option would show a different block of content (Overview, Activity, Settings), use Tabs. If the answer is a value you would save or submit (Monthly or Yearly), use this control.
The motion follows the three beats. Pressing an option charges: its label sinks and the thumb's edge nudges toward it. Releasing makes the thumb's leading edge act, springing to the new option while the trailing edge follows a little later, so across a two-option jump the thumb briefly covers both. It then settles onto the option, and each label changes color only once the thumb is under it. calm shortens this to a glide, playful stretches and bounces more.
Inside a <form> the control renders a hidden radio input, so FormData carries the value under name and a form reset restores the initial value. required uses native validation: a failed check sets the error look until the next pick. For your own validation, set invalid and point aria-describedby at the message:
<SegmentedControl aria-labelledby="visibility-label" aria-describedby={error ? "visibility-error" : undefined} name="visibility" required invalid={Boolean(error)} fullWidth> <SegmentedControlItem value="private" description="Only you"> Private </SegmentedControlItem> <SegmentedControlItem value="team" description="Everyone on the team"> Team </SegmentedControlItem></SegmentedControl>
Pick a layout with preset (pill, card, detail) and a height with size (sm, md, lg; md matches a text field). Every preset is the same raised thumb in a sunken track, and the motion is the same in all of them.
description on an option is announced as its description in every preset, and shown under the label in detail.
badge adds a short chip after the label ("-17%", "New"); it fills with primary while the thumb is under its option.
An icon-only option has no text, so give it an aria-label; it also feeds the tooltip.
Breaking change: the underline preset is gone, because a line under the active label reads as Tabs. Old code that still passes it gets the pill preset; use Tabs for page-level navigation.
Built on Radix RadioGroup: the root is role="radiogroup", each option a button with role="radio" and aria-checked. Name the group with aria-label or aria-labelledby when no visible label does.
required sets aria-required; invalid (or a failed native check) sets aria-invalid. Link the error text with aria-describedby on the root.
An option's description is linked with aria-describedby, so it is read after the name instead of inside it. A badge is part of the name.
Icons, the moving thumb and the hover tile are aria-hidden. Name an icon-only option with aria-label.
Options keep a minimum 24 px hit area, including icon-only ones.
Focus shows a 3 px inset ring in the theme's ring color (destructive while invalid), drawn above the thumb.
Active labels use foreground and inactive ones muted-foreground; a label is always one of the two colors, never a blend, so text keeps AA contrast in light and dark while the thumb passes under it. A single disabled option is struck through as well as dimmed.
With reduced motion (the OS setting, or MotionKitProvider reducedMotion="always") there is no label sink and no nudge. The thumb glides to the new option with both edges together in a 120 ms fade, without stretch or bounce, and labels change color in the same fade. Hover tiles, the error rim and the focus ring still respond.
The thumb is positioned with transform and size from motion values; label colors follow the thumb through attributes, so React does not re-render while it moves.
Option positions are measured on selection change and by a ResizeObserver on the root, so the thumb stays aligned when the container resizes.
Nothing runs at rest: there is no ambient loop to pause off-screen or in hidden tabs.
No lazy-loaded parts; peers are motion and @radix-ui/react-radio-group.
Technical sheet
Motion
calm
260 ms · bounce 0
lively
400 ms · bounce 0.3
playful
540 ms · bounce 0.45
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Size
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom, @radix-ui/react-radio-group, motion.
Dependencies
@radix-ui/react-radio-group · peer
motion · peer
Triggers
click, press, keyboard focus
Reduced motion
No label sink or nudge: the thumb glides to the new option with both edges together in the 120ms fade, without stretch or bounce, and labels change color in the same fade.
Keyboard
Tab
Focuses the selected option; Tab again leaves the control
ArrowRight / ArrowDown
Selects the next option; the thumb travels one step
ArrowLeft / ArrowUp
Selects the previous option
Home / End
Selects the first or last option; the thumb stretches across the row
Space
Selects the focused option
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)