Form
Radio input
Published on
Description
Radio buttons allow users to select exactly one option from a group. All radios in a group share the same name attribute. Group them inside a <fieldset> with a <legend>.
Example
Accessibility
- Use
<fieldset>and<legend>to group radio buttons. Prefer native elements overrole="group". - Add "required" explicitly in the legend text for required radio groups — this is more reliable than ARIA attributes alone. HTML
requiredandaria-invaliddo not work on<fieldset>. - Visually hide inputs using clip/position methods — never
display: none. - Support Windows High Contrast Mode with system color keywords.
References
- Under-Engineered Custom Radio Buttons and Checkboxen (opens in new tab) — Adrian Roselli
- Use Legend and Fieldset (opens in new tab) — Adrian Roselli
- Support for Marking Radio Buttons Required, Invalid (opens in new tab) — Adrian Roselli
Related
- Checkboxes — for multi-selection
- Select — for dropdown selection
Variables
None for input