Native Solid 2 fork. Original documentation and designs © WorkOS; historical posts retain their original context.
Radio Group
A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.
Features
Full keyboard navigation.
Supports horizontal/vertical orientation.
Can be controlled or uncontrolled.
Anatomy
Import all parts and piece them together.
API Reference
Root
Contains all the parts of a radio group.
Item
An item in the group that can be checked. An input will also render when used within a form to ensure events propagate correctly.
Indicator
Renders when the radio item is in a checked state. You can style this element directly, or you can use it as a wrapper to put an icon into, or both.
Examples
Decoupling the hidden input
By default, RadioGroup.Item renders a visually hidden input for form submission. To recompose, move, or exclude that input, you can build each item from its lower-level parts instead.
Important: These parts are unstable and prefixed with
unstable_, so their API may change in a future release.
RadioGroup.unstable_ItemProviderprovides the item state and accepts the item'svalueanddisabledprops.RadioGroup.unstable_ItemTriggeris the interactive element that wrapsRadioGroup.Indicator.RadioGroup.unstable_ItemBubbleInputis the visually hidden input thatRadioGroup.Itemrenders by default. Omit it when you don't need form submission.
Accessibility
Adheres to the Radio Group WAI-ARIA design pattern and uses roving tabindex to manage focus movement among radio items.