A radio group is a grouping of radio buttons that are related to each other.
Examples
$refs.firstTab.focus())"
>
Options
Label
Radio groups should always have a label (usually a legend within a fieldset). In rare cases where context is sufficient and the UX Team have reviewed the design, the label could be undefined. Radio groups without a visible label should still include an aria-label in HTML (depending on the context, “aria-label” or “aria-labelledby”).
Orientation
Radio groups can be either horizontal or vertical. By default, radio groups are vertical. Use a horizontal radio group when vertical space is limited.
Primary
By default, radio buttons are not emphasized. This option is best for when the radio button is not the core part of an interface, such as in application panels, where all visual components are monochrome in order to direct focus to the content. The Primary, or emphasized, version provides a visual prominence that is best for forms, settings, lists or grids of assets, and other situations where a radio button needs to be noticed.
Bordered
The Bordered variant provides a higher level of visual prominence that is best for situations such as a questionnaire or survey where a radio group is the primary component on a page. These work particularly well on touch screen devices as the target area is more clearly visible.
Optional
Radio groups can be marked as optional depending on the situation. Optional radio groups are denoted with text added to the end of the label — “(optional)”.
Error
Radio groups can be marked as having an error to show that a selection needs to be made in order to move forward, or that a selection that was made is invalid. The error is indicated with negative help text, along with an icon.
Disabled
A radio group in a disabled state shows that a selection exists, but is not available in that circumstance. This can be used to maintain layout continuity and communicate that an action may become available later. The field label, radio buttons, and help text are all displayed in a disabled state when the radio group is disabled.
Read-Only
A radio group has a read-only option for when it's in the disabled state but still needs content to be shown. This allows for content to be copied, but not interacted with or changed.
Help Text
Radio groups should use help text for error messaging and descriptions. Descriptions are valuable for giving context behind why a selection is required, or for clarifying the options.
Behavior
Keyboard Focus
A radio button can be navigated using a keyboard. The keyboard focus state takes the radio button's visual hover state and adds a ring to the radio button in focus, copying the color style of the variant.
Text overflow
When the option label is too long for the horizontal space available, it wraps to form another line.
Mixed Value
When a radio button group presents multiple values that are not identical, the group should not show a selection. Any subsequent selection should update all values.
Conditional content
Radio buttons when checked can reveal additional, conditional content.
$refs.secondTab.focus())"
>
Implementation
Example Name
Description and implementation notes
<p> code example </p>
$refs.thirdTab.focus())"
>
Information
Checklist
All interactive states
Includes all interactive states that are applicable (hover, down, focus, keyboard disabled).
All Color Schemes
Works properly across all color schemes (light, dark).
Accessible Contrast for Text
Text has a contrast ratio of at least 4.5:1 for small text and at least 3:1 for large text (WCAG 2.0 1.4.3).
Accessible Contrast for UI Components
Visual information required to identify components and states (except inactive components) has a contrast ratio of at least 3:1 (WCAG 2.1 1.4.11).