Radio Button
Radio buttons allow the user to select one option from a set while seeing all available options.
Examples
Anatomy
- Radio: Allows users to select and deselect the radio button.
- Label: Informs the user what the option is for the radio button.
Spacing
Within the radio button
Ensure that there is at least 8px of horizontal spacing between the radio button and the label.
Usage guidelines
Best practices:
- The list of options should be structured in a logical order, such as from the simplest operation to most complex, or least risk to most.
- Avoid nesting radio buttons with other radio buttons or checkboxes.
Radio buttons should be used when:
- You want users to only select one item from a list of options.
Radio buttons should not be used when:
- You want users to select multiple options. Using the checkbox component would be more appropriate.
Usability guidelines
List available options vertically
It is advisable to display options in a vertical list, as horizontal arrangements can confuse users and make it harder to identify which label corresponds to each option.
Use logical labels
Ensure that labels for radio buttons and groups are clear to the user.
Logical ordering
Ensure that options provided are organised in a meaningful way as this would help users to find the options easily.
Ensure there is enough spacing
Space options out and ensure there is adequate space for touch devices or mobile screens.
Behaviour
Space options out and ensure there is adequate space for touch devices or mobile screens.
Accessibility guidelines
Aria attributes
-
Each radio element is labelled by its content, has a visible label referenced by
aria-labelledby
, or has a label specified witharia-label
or has a label specified with for attribute which points to the radio element's id attribute. -
If elements providing additional information about either the radio group or each radio button are present, those elements are referenced by the
radiogroup
element orradio
elements with thearia-describedby
property.
Keyboard accessibility
-
Tab or Shift-Tab to move focus into and out of the radio group. When focus moves into a radio group:
- If a radio button is checked, focus is set on the checked button.
- If none of the radio buttons are checked, focus is set on the first
- Space checks the focused radio button if it is not already checked.
- ↓, → move focus to the next radio button in the group, uncheck the previously focused button, and check the newly focused button. If focus is on the last button, focus moves to the first button.
- ↑, ← move focus to the previous radio button in the group, uncheck the previously focused button, and check the newly focused button. If focus is on the first button, focus moves to the last button.
Focus indicator
- Ensure that radio buttons have a clear, visible focus indicator to help users identify which element is currently focused.
- Group radio buttons within a fieldset and provide a legend to describe the group contextually. Ensure logical focus order within the group.
Radio button design tokens
Last updated 02 October 2024