Radio
Use Radio Buttons to offer a visible list of choices where only a single selection is possible. Only one Radio Button of a group can be active at a time. You must never use single Radios, you might need to use a Checkbox or a Switch instead.
Example
Live Editor
Result
Loading...
Usage Rules
Do:
- Have one option (usually the most desired one) set by default
- Layout your option list vertically, with one choice per line
- Use active wording and avoid negations in labels
- Use Radio button instead of a Select if there are less than 4 options to choose from
Don’t:
- Use as action buttons
- Use if multiple options can be selected
- Use to toggle items on or off. Use Switch instead
Variants
Disabled
Live Editor
Result
Loading...
Icons
Using prefixIcon
or suffixIcon
to render the icon and colorIcon
to color the icon, the default color is ColorNeutral140 (#191d2f).
Live Editor
Result
Loading...
Helper Text
You can add an extra description to radio using helperText
.
Live Editor
Result
Loading...
Ref
You can access to the input native element using ref
.
Live Editor
Result
Loading...
Required
In case of group radio buttons, you only need to add required
to one item.
Live Editor
Result
Loading...
Props
Name | Type | Default |
---|---|---|
name * Native HTML attribute: Link |
| — |
value * Native HTML attribute: Link |
| — |
disabled Native HTML attribute: Link |
| — |
css Add custom styles to this component. Use with caution. Learn more here: Link |
| — |
inputFieldCss |
| — |
label The label for the radio |
| — |
aria-label Provide at least one label(visual or non-visual) property for better accessibility. Check Accessibility page for more info: Link |
| — |
aria-labelledby Provide at least one label(visual or non-visual) property for better accessibility. Check Accessibility page for more info: Link |
| — |
id Native HTML attribute: Link |
| — |
checked Native HTML callback: Link |
| — |
required Native HTML attribute: Link |
| — |
readOnly Native HTML attribute: Link |
| — |
onChange Native HTML callback: Link |
| — |
helperText HelperText for radio |
| — |
tabIndex Tab index |
| — |
prefixIcon The prefix icon | "AddValue" | "AppGrid" | "ArrowCircleLeft" | "ArrowCircleRight" | "ArrowDown" | "ArrowDownLeft" | "A... | — |
suffixIcon The suffix icon | "AddValue" | "AppGrid" | "ArrowCircleLeft" | "ArrowCircleRight" | "ArrowDown" | "ArrowDownLeft" | "A... | — |
colorIcon The color of icon |
| — |
ref |
| — |
key |
| — |
data-{foo} Data attributes can be used by testing libraries to retrieve components or assert their existence |
| — |
* - the prop is required. |