Radio group
Radio group is used to render a short list of mutually exclusive options.
On this page
On this page
import {RadioGroup} from '@primer/react-brand'
Examples
Default
RadioGroup
creates a semantic container for multiple related radio inputs. Note that all radio inputs must share the same name
prop to function as a group.
With caption
Use RadioGroup.Caption
to provide additional context for the group.
With validation
RadioGroup.Validation
can display success or error states with appropriate icons.
Inline
When space is limited, radio inputs can be arranged horizontally using the Stack component.
Component props
RadioGroup Required
Name | Type | Default | Description |
---|---|---|---|
children | React.ReactElement[] | RadioGroup components and FormControl components | |
id | string | Sets a custom id. If not provided, a unique id will be generated |
RadioGroup
extends the HTML fieldset
element and supports all fieldset
props.
RadioGroup.Label Required
Name | Type | Default | Description |
---|---|---|---|
children | string | Label text | |
visuallyHidden | boolean | false | Hide label visually but keep accessible |
RadioGroup.Label
extends the HTML legend
element and supports all legend
props.
RadioGroup.Caption
Name | Type | Default | Description |
---|---|---|---|
children | string | Caption text |
RadioGroup.Caption
extends the span
element and supports all span
props.
RadioGroup.Validation
Name | Type | Default | Description |
---|---|---|---|
children | string | Validation message | |
variant | 'error' 'success' | Sets the validation state and icon |
RadioGroup.Validation
extends the span
element and supports all span
props.