Radio buttons
Radio buttons are a type of question format. They require users to pick only one option from a list. For example, for a true or false question, the user may only select either true or false.
Radio buttons decrease the chance of user error or not understanding the options.
When to use
- To only allow one answer: for example, when giving a choice of “yes” or “no” for release of information.
- To toggle between showing and hiding a field: for example, a true or false boolean that shows or hides a field.
When not to use
- For lists of more than six options.
- With limited screen space (use a select component but beware of usability issues).
- For questions with more than one answer (use a checkbox component).
Open all
Open all
- Group related radio buttons with
<fieldset>
and describe the group with<legend>
. - Assign each radio button a
<label>
. Match the<for>
attribute of the<label>
to the<id>
attribute of the<input>
. - Always place a radio button to the left of its
<label>
for people using screen magnifiers.
- Set the
aria-checked
attribute to true for a selected radio button. - Set the
aria-checked
attribute to false for an unselected radio button. - Ensure enough space on the target area for touch screens. Consider using the tile variant for larger touch targets.
- Default answers can create bias or alienate a user. So set them with caution.
- To let a user select zero options or change their mind on an answer, include a radio button that says "None of the above."