RadioGroup
RadioGroup is used to render a short list of mutually exclusive options.
Page navigation navigation
React examples
Default
With a caption
With a validation message
See the form pattern documentation for more information on form validation patterns.
Selection required
More code examples
See the RadioGroup Storybook stories
Props
RadioGroup
| Name | Default | Description |
|---|---|---|
aria-labelledby | stringUsed when associating the input group with a label other than RadioGroup.Label | |
children Required | RadioGroup.Label | RadioGroup.Caption | RadioGroup.Validation | FormControl | |
disabled | false | booleanWhether the input group allows user input |
id | A generated string | stringThe unique identifier for this input group. Used to associate the label, validation text, and caption text. You may want a custom ID to make it easier to select elements in integration tests. |
name Required | stringThe name used to identify this group of radios | |
onChange | (selected: string | null, e?: ChangeEvent<HTMLInputElement>) => voidAn onChange handler that gets called when the selection changes | |
required | false | booleanIf true, the user must make a selection before the owning form can be submitted |
sx Deprecated | SystemStyleObject |
RadioGroup.Label
| Name | Default | Description |
|---|---|---|
visuallyHidden | false | booleanIf true, the fieldset legend will be visually hidden |
sx Deprecated | SystemStyleObject |
RadioGroup.Caption
| Name | Default | Description |
|---|---|---|
children | React.ReactNodeThe caption content | |
sx Deprecated | SystemStyleObject |
RadioGroup.Validation
| Name | Default | Description |
|---|---|---|
children | React.ReactNodeThe validation message | |
variant Required | 'error' | 'success'Changes the visual style to match the validation status | |
sx Deprecated | SystemStyleObject |