Radio button (web component)
Radio buttons indicate the option that has been selected from a set of mutually-exclusive options.
Also known as: form radio, option button, radio button, radio group, selection control, single-select options
Looking for the HTML version? See Radio button (HTML)
<bolt-radio-group label="Radio button group" name="testname1">
<bolt-radio value="1">First option</bolt-radio>
<bolt-radio value="2">Second option</bolt-radio>
<bolt-radio value="3">Last option</bolt-radio>
</bolt-radio-group>
Alternate states
Permalink to "Alternate states"<bolt-radio-group label="Radio button group" required name="testname1-1" error="Please choose an option below.">
<bolt-radio value="1">First option</bolt-radio>
<bolt-radio value="2">Second option</bolt-radio>
<bolt-radio value="3">Last option</bolt-radio>
</bolt-radio-group>
<bolt-radio-group label="Group name" name="testname-err-no-message" required invalid>
<bolt-radio value="1">First option</bolt-radio>
<bolt-radio value="2">Second option</bolt-radio>
<bolt-radio value="3">Last option</bolt-radio>
</bolt-radio-group>
<bolt-radio-group label="Radio button group" name="testname3" disabled>
<bolt-radio value="1">First option</bolt-radio>
<bolt-radio value="2">Second option</bolt-radio>
<bolt-radio value="3">Last option</bolt-radio>
</bolt-radio-group>
<bolt-radio-group label="Radio button group" name="testname4">
<bolt-radio value="1" disabled>First option disabled</bolt-radio>
<bolt-radio value="2">Second option</bolt-radio>
<bolt-radio value="3">Last option</bolt-radio>
</bolt-radio-group>
Optional features
Permalink to "Optional features"Descriptive text
Permalink to "Descriptive text"<bolt-radio-group label="Radio button group" name="testname8">
<bolt-radio value="1" description="Label description. Plain text ONLY, no inline formatting. No links or images.">First option</bolt-radio>
<bolt-radio value="2" description="Label description. Plain text ONLY, no inline formatting. No links or images.">Second option</bolt-radio>
<bolt-radio value="3">Last option</bolt-radio>
</bolt-radio-group>
Contextual help
Permalink to "Contextual help"Help text body content
<bolt-radio-group label="Radio button group" name="testname6">
<bolt-contextual-help slot="help" heading="Help text heading">
<p>Help text body content</p>
</bolt-contextual-help>
<bolt-radio value="1">First option</bolt-radio>
<bolt-radio value="2">Second option</bolt-radio>
<bolt-radio value="3">Last option</bolt-radio>
</bolt-radio-group>
Appearance options
Permalink to "Appearance options"Labels
Permalink to "Labels"<bolt-radio-group label="Non-required radio group" optionaltext="hide" name="testname5" >
<bolt-radio value="1">First option</bolt-radio>
<bolt-radio value="2">Second option</bolt-radio>
<bolt-radio value="3">Last option</bolt-radio>
</bolt-radio-group>
Layout
Permalink to "Layout"Horizontal radios should only be used for boolean choices (e.g., Yes/No, True/False, etc.) to prevent unintended visual grouping and other display issues.
<bolt-radio-group label="Horizontal radio buttons" name="testname2" horizontal>
<bolt-radio value="1">Yes</bolt-radio>
<bolt-radio value="2">No</bolt-radio>
</bolt-radio-group>
Bounded version
Permalink to "Bounded version"<bolt-radio-group label="Radio button group" bounded>
<bolt-radio value="1">First option</bolt-radio>
<bolt-radio value="2">Second option</bolt-radio>
</bolt-radio-group>
The web component implementation reduces the need for explicitly-defined behavioral logic. However, it provides limited control over the underlying HTML markup.
If you require maximum control over the HTML markup, check out the HTML implementation.
The radio button component is composed of two custom elements: <bolt-radio-group> and <bolt-radio>:
<bolt-radio-group label="Group label goes here" name="controlName" >
<bolt-radio value="1">Item 1 label</bolt-radio>
<bolt-radio value="2">Item 2 label</bolt-radio>
<bolt-radio value="3">Item 3 label</bolt-radio>
</bolt-radio-group>
<bolt-radio-group label="Group label 2 goes here" name="contro2lName" horizontal>
<bolt-radio value="1">Yes</bolt-radio>
<bolt-radio value="2">No</bolt-radio>
</bolt-radio-group>
Radio button group
Permalink to "Radio button group"The <bolt-radio-group> element provides a wrapper around native <fieldset> and <legend> elements, applying a label (via the label attribute) to the set of <bolt-radio> elements.
The two elements must be used together. Only <bolt-radio> elements can be children of the <bolt-radio-group>.
The <bolt-radio-group> element must include one of these three parameters:
label: The label text, used to populate the underlying<legend>element.arialabel: If present, sets thearia-labelattribute of the underlying<fieldset>element.arialabelledby: If present, sets thearia-labelledbyattribute of the underlying<fieldset>element.
Additionally, the <bolt-radio-group> element supports the following parameters:
name: required. The value for thenameattribute must be unique for each set of options.horizontal: optional. Radio buttons are stacked vertically by default, which should be the case for the majority of uses. If present, this causes the radio buttons to display horizontally. Please see the "Design guidelines" tab for details on when this option should be used.value: optional. The currently selected value.instructionaltext: optional. The instructional text to display below the label. This should be used to give users additional information about the radio group.required: optional. If present, the field is required. Fields that are not required will show "(optional)".optionaltext: optional.show(default) orhide. Use to remove the "(optional)" text from non-required fields.disabled: optional. If present, disables rendered interactive elements.error: optional. The error message to display.- Should not be used when component is
disabled.
- Should not be used when component is
invalid: optional. If present, the group appears invalid.bounded: optional. If present, the radio buttons appear with a bounded border.- Bounded radio buttons do not support contextual help on individual options. See
descriptioninstead.
- Bounded radio buttons do not support contextual help on individual options. See
The <bolt-radio-group> element supports the use of <bolt-contextual-help> via the help slot placeholder. For more information and to see other options visit the contextual help page.
Radio button
Permalink to "Radio button"The <bolt-radio> element provides a wrapper arount native <input> and <label> elements and apply appropriate layout and data access APIs.
<bolt-radio> supports the following attributes:
value: required. The value of the radio button, which must be a string. Thevalueattribute will not accept an object.disabled: optional. If present, disables rendered interactive elements.checked: optional. If present, the control is checked. This can be used instead of thebolt-radio-group's value attribute.arialabel: optional. If present, sets thearia-labelattribute of the underlying<label>element.arialabelledby: optional. If present, sets thearia-labelledbyattribute of the underlying<label>element.invalid: optional. If present, the control appears invalid.datatestradio: optional. Property to configure thedata-testvalue on the underlying<input>element.description: optional. Property adds descriptive text to an individual radio button. Must be plain text.- Can't be used with horizontal layout.
Note
The <bolt-radio> slotted content can only contain plain text which sets the visual label for the radio button.
Internals
Permalink to "Internals"Test selectors
Permalink to "Test selectors"- <bolt-radio>
[data-test="radio-N"]targets rendered radio <input>, whereNis a zero-based index (e.g.,radio-0for the first rendered radio,radio-1for the 2nd rendered radio, etc.)- Configurable on each
<bolt-radio>via thedatatestradiopropertydatatestradioproperty MUST be configured when<bolt-radio>element is added to the DOM
- Configurable on each
General guidelines
Permalink to "General guidelines"- Radio buttons should be placed in a logical order (e.g., alphabetical, most likely to least likely, simplest to most complex, least to most risk).
- Include an "Other," "Does not apply," or similar option for users who may not want to answer or if not all possible options are listed. Consider alternatives if a selection is not required, like using a Radio group with an option equating to "none of these options."
- Text labels should wrap, keeping the Radio selector glyph itself aligned with the first line of a label.
- Except for decisions that require a boolean choice (e.g., Yes/No, True/False, etc.), do not use side-by-side horizontal positioning of radio buttons to prevent an unintended visual grouping of unrelated options.
- Lay out lists of Radio buttons vertically, with one option per line for ease of comprehension.
- A Radio button should not be used on its own; it should be rendered in a group of at least two or more options.
- Combine Radio buttons with a fieldset and legend for the best context and accessibility.
- Both the Radio button AND its label should be able to be used to make a selection.
- To verify a deliberate selection, no Radio button should be selected by default unless a selection must be made by default for a page to render (example, a defaulted selection in a filter).
- Once a Radio button is selected, it cannot be deselected. Choosing another related Radio button should change the state back to unselected.
- Avoid individual Radio button validation messages or styles; validation should be displayed at the group level.
- Input validation and error messaging for Radio buttons should only occur after form submission.
- Radio buttons may be used in a list, form, or table for single selections.
When to use
Permalink to "When to use"- When a user must make a single, mutually exclusive selection from 2-8 options.
- When a selection doesn't have an immediate effect and/or requires form submission.
- When viewing all available options is critical.
When not to use
Permalink to "When not to use"- Don't use Radio buttons as an alternative to a Button or Link for actions or navigation.
When to use something else
Permalink to "When to use something else"- Avoid using Radio buttons when multiple choices are allowed; use Checkboxes instead.
- Avoid Radio buttons for situations where users can deselect items; use Checkboxes instead.
- Avoid Radio buttons when a selection results in immediate changes, especially on mobile; use Switch instead.
- Avoid Radio buttons when it's visually difficult to observe the state change; use Switch instead.
- If there are more than 8 options presented, use Select in order to avoid clutter.
Do
- Present Radio button options in a logical order.
- Allow text wrapping beneath Radio buttons. Keep the Radio selector glyph aligned with the first line of a wrapping label.
- Include a label for each Radio button.
- Combine Radio buttons with a fieldset and legend for the best context and accessibility.
- Keep legends and labels concise and descriptive.
- Use Radio buttons for single selections from 2 to 8 options.
Don't
- Don't default a selection in a Radio group.
- Don't use Radio buttons when multiple items can be selected.
- Don't vertically center label text inside Radio buttons.
- Don't nest Radio buttons.
- Don't use Radio groups for selecting multiple items.
- Don't use side-by-side horizontal positioning in order to prevent unintended visual grouping.
Content guidelines
Permalink to "Content guidelines"- Radio button labels use sentence case.
- Error messages use sentence case and include a period.
- Keep labels and legends concise and simple.
Accessibility compliance
Permalink to "Accessibility compliance"-
WCAG 2.2 Compliant
-
JAWS 2025 Tested
-
NVDA 2025 Tested
-
VoiceOver Tested
-
Keyboard Tested
-
aXe Tested
Accessibility issues
Permalink to "Accessibility issues"Voice over
Permalink to "Voice over"- Safari + Voice over will not read descriptive text automatically and instead announce that more content is available.
All Bolt components have gone through accessibility testing, but please keep our accessibility guidelines in mind.