Use to pick one option from a few that should all stay visible. Variants include option cards, horizontal layout and a small size. Arrow keys move the shared dot.
Use a radio group to pick one option out of a few that should all stay visible: a shipping method, a
plan, a row density. For long lists use a select or combobox, and for independent on/off choices use
checkboxes or switches.
The group draws one dot, not one per option. Pressing an option charges: its ring lights to
primary and the dot stretches toward it. Releasing throws the dot through the gap between the
options, and it settles by squashing into the ring it lands in. Arrow keys make the same trip one
option at a time. calm glides without squash, playful stretches and wobbles.
Requires the @motionkit namespace in components.json. See Installation.
It installs to components/ui/radio-group.tsx, the same path as the shadcn radio group, and keeps
its API (value, defaultValue, onValueChange, disabled, required, name, loop, dir),
so it is a drop-in replacement.
Also accepts all props of Omit<
ComponentProps<typeof RadioGroupPrimitive.Root>,
"asChild" | "orientation"
>.
RadioGroupItem
Prop
Type
Also accepts all props of Omit<
ComponentProps<typeof RadioGroupPrimitive.Item>,
"asChild" | "children"
>.
RadioGroupItem takes value (required), disabled, className, ref, children (the label, or
the title in the card variant) and description (a secondary line announced with the option).
variant="card" turns each option into a bordered tile with a title and description and the ring at
its top-left. It is the same dot with a longer trip. The demo shows the error look: with aria-invalid
and nothing chosen, every enabled ring takes the destructive rim, and choosing an option clears it.
Disabled options never charge and arrow keys skip them.
orientation="horizontal" lays the options in a row and moves the dot along x. size="sm" uses a
16px ring with a 6px dot. A horizontal group that wraps onto two lines travels within a line and
crossfades between lines.
Built on Radix RadioGroup: role="radiogroup" with button role="radio" items and
aria-checked. Name the group with aria-labelledby or aria-label.
Each option is named by its label (default variant) or its title (card variant); the
description is announced as the option's description.
The shared dot and the hover halos are decorative (aria-hidden); the state is conveyed by
aria-checked. There is no live region: the selection is announced on the focused radio.
Focus shows a 3px ring in the theme's ring color, on the ring or on the card tile, drawn above the dot.
The whole row (ring and label) or the whole card is the hit area, at least 24px tall.
Hover and touch-down grow a halo behind the ring, so feedback does not rely on a color change alone.
Colors come from your theme: rim input, selected rim and dot primary, errors destructive,
descriptions muted-foreground, so contrast follows your shadcn theme in light and dark.
With reduced motion (the OS setting, or MotionKitProvider reducedMotion="always") there is no
stretch, squash or travel: the dot fades out of the old ring and into the new one in the short fade
time, and the rims light and dim in the same fade. It stays one dot, and the lit ring and the dot
show the choice at every frame.
One dot for the whole group moves on a single rail with transforms; the squash is derived from
its position, so React does not re-render while it travels.
Ring centres are measured from layout offsets, with a ResizeObserver on the group, and only
again when the group resizes or its options change.
Hover halos and rim colors are CSS transitions. There is no loop, nothing runs at rest, and no
timers or canvases need cleaning up.
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 6.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
press, click, a value change
Reduced motion
The dot fades out of the old ring and into the new one in the short fade time, with no stretch or squash; the rims light and dim in the same fade.
Keyboard
Tab
Moves focus to the checked option (or the first) and out of the group
ArrowDown / ArrowRight
Focuses and selects the next option; the dot charges on key down and travels on key up
ArrowUp / ArrowLeft
Focuses and selects the previous option, the same trip backwards
Space
Selects the focused option if none is checked
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)