RadioGroup
Choose one value from a visible set of radio options.
Anatomy#
Usage#
Use RadioGroup for one choice from a small visible set. The group renders a <fieldset>; legend
names it, or a wrapping Field label takes precedence.
- For a longer or space-constrained collection, use Select.
- When several options may be selected together, use CheckboxGroup.
Single selection#
items takes strings (used as both value and label) or objects with value, label,
description, and disabled. Disabled items stay visible but cannot be selected or focused.
The selected item is one string: use defaultValue for uncontrolled state, or pair value with
onValueChange for controlled state. onValueChange fires only when the user selects a different
item. variant sets the layout (list, card, or table), and orientation sets the direction.
Keyboard interaction#
The group is one tab stop. The arrow keys that match orientation move focus to the next enabled
item and select it. Home, End, and Shift with an arrow key move focus without selecting.
Space selects the focused item. Navigation wraps unless loop={false}.
Forms#
Set name for native form submission. For schema binding and validation, place the group inside
form.Field from createForm. Standalone Field supplies
labels and messages without binding a form store.
Indicator#
indicatorPosition places the radio mark at the leading or trailing edge, or hides it with
hidden.
Examples#
Controlled#
Pair value with onValueChange to control the selected option from page state.
Disabled item#
Set disabled on individual items to keep them visible without allowing selection.
Form#
Place RadioGroup in form.Field so schema validation owns the selected value.
Indicator position#
indicatorPosition="trailing" puts the radio on the trailing edge of a card option. Use hidden when the card
itself is the selected affordance.
API Reference#
Attributes#
data-disableddata-invaliddata-readonlydata-requireddata-checkedProps#
Props for the RadioGroup component. Renders a <div> element by default.