Radio

Radio buttons are used to select a single item from several mutually exclusive options.

Interactive Playground

The Interactive Playground allows you to experiment with various radio button styles and features. Once you get the results you want, copy the HTML or React code provided and paste it into your application.

<form class="neo-form">
<div class="neo-form-control">
<div class="neo-input-group">
<label for="Default Radio Group">
Select Option
</label>
<input
class="neo-radio"
type="radio"
name="Default Radio Group"
value="Calendar"
id="calendar"
role="radio"
aria-checked="false"
>
<label for="calendar">
Calendar
</label>
<input
class="neo-radio"
type="radio"
name="Default Radio Group"
value="Calculator"
id="calculator"
role="radio"
aria-checked="false"
>
<label for="calculator">
Calculator
</label>
<input
class="neo-radio"
type="radio"
name="Default Radio Group"
value="Notes"
id="notes"
role="radio"
aria-checked="false"
>
<label for="notes">
Notes
</label>
</div>
</div>
</form>
<Form id="radio-form">
<RadioGroup
groupName="Default Radio Group"
label="Select Option"
selected={selectedExampleRadio}
onChange={(e) => setSelectedExampleRadio(e.target.value)}
>
<Radio value="Calendar">Calendar</Radio>
<Radio value="Calculator">Calculator</Radio>
<Radio value="Notes">Notes</Radio>
</RadioGroup>
</Form>

Anatomy

Radios are used to select a single option from a list of related options. They should include a label to identify the feature it controls if there is enough space on the screen.

Image showing a radio group with one selection, there are four notes pointed out and described below
  • Radio Group Label (optional):

    Identifies the common factor for this group of buttons.
  • Radio Label:

    This is the active element used to select the option. When selected, the radio button appears as a filled circle.
  • Radio Button:

    Shows the function controlled by that button.
  • Unselected Radio Button:

    The radio button is an empty circle while not selected.

States

A radio button can exist in several states. When unselected, the associated function is turned off. The function is turned on when the button is selected. A disabled radio button’s state cannot be changed until some other action has occurred (e.g. configuring another field on the page). Read-only shows that the option has already been set and cannot be changed.

Unselected
Image showing a radio button in the unselected state
Selected
Image showing a radio button in the selected state
Disabled
Image showing a radio button in the disabled state
Read-only
Image showing a radio button in the read only state
  • Unselected:

    This shows that the option is not active.
  • Selected:

    This radio button’s controlled function is active.
  • Disabled:

    The function of this button is not available for selection. Some other action may be required to enable it.
  • Read-only:

    This option has been selected, usually on another screen, and cannot be changed from here. It is shown for information only.

Behavior

Displayed below are some examples of proper and improper usage of the Radio component.

Image showing a radio group with a single item selected

DO: Use radio buttons to select a single item from a list.

Image showing a radio group with multiple items selected

DON'T: Do not use radio buttons to select multiple items. Use a checkbox instead.

Image showing a list of five radio options and one selected

DO: Use radio buttons for a small list of items to choose between.

Image showing a list of over ten radio options and one selected

DON'T: Do not use radio buttons for large lists of items. Use select instead.

Content Overflow

Use the following guidelines to help you decide how to treat long labels.

Image showing radio buttons with multiline text

DO: When the label is too long for the space available, wrap it onto another line.

Image showing radio buttons with mixed multiline text and long single line text

DON'T: Do not use multiline text when other labels are not multiline and when there is enough space.

Text Alignment

The text field for a Radio button should always align to the top of the button icon. This applies to both single and multiline content.

Image showing radio buttons with labels that wrap to a second line with their top aligned with the top of the radio button.

DO: Align the top of the button label text with the top of each radio button icon.

Image showing radio buttons with labels that wrap to a second line with their top aligned with the top above the radio button.

DON'T: Do not center justify the button icon with multiline text.

Category Labels

Category labels are used to collect groups of related radio items.

Image showing a radio group with a properly descriptive label

DO: For a group of related radio buttons, add a category label to connect them together.

Image showing a radio group without a label

DON'T: Do not exclude the category label for connected radio button groups.

Error

An error message must be displayed when the user tries to exit before making a required selection.

Image showing a radio group with correctly-used helper text in error state

DO: Use helper text to inform the user that and error has occurred, to explain what the problem is and how to fix it.

Image showing a radio group using colored buttons to indicate error state

DON'T: Do not use colored radio buttons to indicate that a selection is required.

Specs

Each radio button icon has a diameter of 16 pixels, with 8 pixels of padding between the icon and its label.

Image showing spacing around the radio button, 16px on the left and top, and 8px between the radio button and the label

There should be 8 px between the list title and the first item of the group. Always leave a minimum of 8 px margin between vertically stacked radio groups. Always leave a minimum of 16 px margin between on all sides for horizontal radio groups.

Image showing the vertical margin between the radio buttons in a vertically aligned group, 8px
Image showing the margin between the radio buttons in a horizontal group, 16px

Keyboard Interactions

Accessibility requires that each item on the screen is reachable using the keyboard alone. The mouse is not always an option for some users.

Keyboard navigation employs the following shortcuts.

Keystrokes Interaction
Tab Moves and selects the next radio option in a group.
Shift + Tab Moves and selects the previous radio option in a group.
← Left Arrow and → Right Arrow Moves horizontally between the radio options.
↑ Up Arrow and ↓ Down Arrow Moves vertically between the radio options.
Phow

Components