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
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
Helper Text
You can add an extra description to radio using helperText
.
Icons
Using prefixIcon
or suffixIcon
to render the icon and colorIcon
to color the icon, the default color is ColorNeutral140 (#191d2f).
Label Info Tooltip
You can add more information for label by adding labelIconTooltip
.
The tooltip content
can either be pure text or any rich content wrapped in a React component. The tooltip position
is used to define the positioning of the tooltip
When the tooltip content
is not provided, the label icon will be not shown.
Ref
You can access to the input native element using ref
.
Required
In case of group radio buttons, you only need to add required
to one item.
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 |
| — |
labelIconTooltip The label info tooltip icon |
| — |
prefixIcon The prefix icon | "AddValue" | "Adjust" | "AIAgent" | "AppGrid" | "ArrowCircleLeft" | "ArrowCircleRight" | "ArrowDown"... | — |
suffixIcon The suffix icon | "AddValue" | "Adjust" | "AIAgent" | "AppGrid" | "ArrowCircleLeft" | "ArrowCircleRight" | "ArrowDown"... | — |
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. |