Radio group
A group of radio buttons for selecting one option from a set.
Import
import { RadioGroup } from '@oztix/roadie-components/radio-group'
Examples
Default
<RadioGroup> <RadioGroup.Item value='email' label='Email' /> <RadioGroup.Item value='phone' label='Phone' /> <RadioGroup.Item value='post' label='Post' /> </RadioGroup>
With Field
Wrap RadioGroup in Field for consistent layout, labels, and error handling.
With standalone label
RadioGroup also has its own RadioGroup.Label for standalone usage without a
Field wrapper.
Variants
Horizontal direction
<RadioGroup direction='horizontal'> <RadioGroup.Item value='small' label='Small' /> <RadioGroup.Item value='medium' label='Medium' /> <RadioGroup.Item value='large' label='Large' /> </RadioGroup>
Emphasis
Use the emphasis prop on the Root to control the visual weight of all items.
Normal
<RadioGroup emphasis='normal'> <RadioGroup.Item value='standard' label='Standard delivery' /> <RadioGroup.Item value='express' label='Express delivery' /> <RadioGroup.Item value='overnight' label='Overnight delivery' /> </RadioGroup>
States
Accessibility
- Keyboard:
Arrow Up/Arrow Downmoves between radio items.Spaceselects the focused item. Base UI manages roving tabindex. - ARIA: Base UI Radio sets
role="radiogroup"on the root androle="radio"witharia-checkedon each item automatically. - Grouping: Wrap in a
Fieldsetwith aLegendto provide a group label for screen readers.
API reference
RadioGroup
Base UIWhether the component should ignore user interaction.
Defaults to false.
Whether the user should be unable to select a different radio button in the group.
Defaults to false.
Whether the user must choose a value before submitting a form.
Defaults to false.
Identifies the field when a form is submitted.
The controlled value of the radio item that should be currently selected. To render an uncontrolled radio group, use the `defaultValue` prop instead.
The uncontrolled value of the radio button that should be initially selected. To render a controlled radio group, use the `value` prop instead.
Callback fired when the value changes.
A ref to access the hidden input element.
RadioGroup.ErrorText
No additional props — forwards all standard HTML attributes to the underlying element.
RadioGroup.HelperText
No additional props — forwards all standard HTML attributes to the underlying element.
RadioGroup.Item
Base UIInherited from RadioRootProps
The unique identifying value of the radio in a group.
Whether the component should ignore user interaction.
Whether the user must choose a value before submitting a form.
Whether the user should be unable to select the radio button.
A ref to access the hidden input element.
Inherited from NonNativeButtonProps
Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `true` if the rendered element is a native button.
Defaults to false.