Skip to content

role group

Radio group draft v0.1.0

Lets people choose exactly one option from a short, visible set.

A radio group shows every option at once, with a legend naming the choice, and lets people check exactly one of them: checking an option unchecks the previous one. Use it when the options are few and worth reading side by side; a long list of options is a Select, and independent on/off options are Checkboxes. The group is one component: the options are its repeated part, each with its own label, description, value and disabled state.

Guidelines

From apps/docs/content/components/radio-group.md

Overview

A radio group shows every option at once under a legend that names the choice, and lets people check exactly one of them. Checking an option unchecks the previous one, so the group always has at most one answer. The group is the component: the options are its repeated part, each with a label, an optional description, a value and its own disabled state.

This page applies to every platform. Where a platform differs, the difference sits under a sub-heading named after it (Web, iOS, Android, Desktop); everything else holds everywhere.

When to use

  • Exactly one choice among two to about six options that people should read side by side (delivery method, plan, frequency).
  • The options carry a short explanation each (price, delay) that a dropdown would hide.
  • A yes / no / not sure question in a form.

When not to use

  • Several options can be chosen. Use Checkboxes.
  • Many options, or options people already know. Use a Select: it saves space and shows the current choice.
  • An on / off setting that applies immediately. Use a Switch.
  • A single option. A radio button cannot be unchecked: use a Checkbox.

Orientation

Orientation Use for
Vertical The default: one option per line, easy to scan, with room for descriptions.
Horizontal Two or three short options on one line (Yes / No / Not sure). Avoid it when options have descriptions or wrap to several lines.

Sizes

Size Use for
Small Dense panels and tables, with a 14 px label.
Medium Forms and settings, the default, with a 16 px label.

The radio, the option label and its description scale together; the legend keeps one size. The exact values are tokens (Tokens tab).

Legend, descriptions and error

The legend names the choice and is announced first. A description under the legend helps for the whole choice; a description under an option explains that option. When the group is invalid, the error message appears last and says what to do; every radio is described by it.

States

States belong to the options; the group as a whole only passes its disabled and invalid properties down to them.

State How it happens What changes
Default Resting, unchecked. An outlined, empty circle.
Hover A pointer rests over a radio or its label. Needs a pointing device: there is no hover on touch. The empty circle takes a light tint. A checked radio does not change.
Focus visible Keyboard focus on a radio. The shared focus ring appears outside it. Pointer focus shows no ring.
Checked The option’s checked property, or activation. The circle fills with the brand color and shows a dot.
Invalid The group’s invalid property, after validation. Every radio border takes the error color; the error message is shown.
Disabled The group’s disabled property, or an option’s. Radio, label and description drop to the shared disabled colors.

Content

  • The legend is the question or the thing chosen: Delivery method, How often should we email you?
  • Option labels are short, parallel and mutually exclusive: Standard, Express, Pickup. Sentence case, no trailing punctuation.
  • Costs, delays and consequences go to the option’s description.
  • Order options logically, and offer a neutral option (None, Not sure) when people may have no preference. Pre-check the most common option only when a default is safe.
  • The error message says what to do: Choose a delivery method.

Accessibility

The Specification tab lists the full accessibility contract, grouped into what holds on every platform and what is specific to one. Each statement there links the source it comes from. This section explains the decisions behind it.

Web

  • The implementation renders a <fieldset> with a <legend>, and <input type="radio"> elements sharing one name, each with a <label for> (ARIA in HTML: fieldset, ARIA in HTML: input type=radio, HTML: radio button group). The browser keeps one option checked and moves the check with the arrow keys. It never sets aria-checked, which ARIA in HTML forbids on a native radio.
  • Help text and the error message are referenced by aria-describedby from every radio (ARIA1); an invalid group sets aria-invalid="true" on them (ARIA21).
  • Disabling the group uses the fieldset’s disabled attribute, which disables every radio (HTML: fieldset disabled).
  • The focus ring uses :focus-visible (MDN: :focus-visible), and the transition is switched off under prefers-reduced-motion.

iOS

Android

  • Checkbox (any number of options)
  • Select (one option among many)
  • Switch (an on / off setting applied immediately)