Radio Buttons

Radio buttons are used for selection of only one option from a group of values.

Coded Components

Helper classes: Looking for a complete list of helper classes for these components?View helper classes

Redlines: We don't include redline comps because it's always more accurate to use developer tools to inspect the coded components, or a plugin such as the Prism Redline Tool.

Radio Buttons

Standard Radio Buttons with Optional Title

<fieldset> <legend class="dds__mb-1"> Sample Standard Radio Buttons Title (Optional) </legend> <!-- // temporary class (dds-radio-button) for radio buttons to make the
// click area bigger. should do the same for other
// form inputs. Delaying that because of potential
// conflicts with another story that's being worked on
// Mar 21, 2019 -->
<div class="dds__form-check"> <label class="dds__form-check-label" for="stndRadio1"> <input class="dds__form-check-input" type="radio" name="exampleRadios" id="stndRadio1" value="standardopt1"> <span>Value 1</span> </label>
</div>
<div class="dds__form-check"> <label class="dds__form-check-label" for="stndRadio2"> <input class="dds__form-check-input" type="radio" name="exampleRadios" id="stndRadio2" value="standardopt2"> <span>Value 2 has a lengthy label to test wrapping</span> </label>
</div>
<div class="dds__form-check dds-radio-button"> <label class="dds__form-check-label" for="exampleDisabledRadio"> <input class="dds__form-check-input" type="radio" name="exampleRadios" id="exampleDisabledRadio" value="option3" disabled=""> <span>Value 3 (disabled)</span> </label>
</div> </fieldset>

Inline Radio Buttons with Optional Title

<fieldset> <legend class="dds__mb-1"> Sample Inline Radio Buttons Title (Optional) </legend> <div class="dds__form-check dds__form-check-inline"> <label class="dds__form-check-label" for="exampleRadios1"> <input class="dds__form-check-input" type="radio" name="exampleInline" id="exampleRadios1" value="option1"> <span>Value 1</span> </label>
</div>
<div class="dds__form-check dds__form-check-inline"> <label class="dds__form-check-label" for="exampleRadios2"> <input class="dds__form-check-input" type="radio" name="exampleInline" id="exampleRadios2" value="option2"> <span>Value 2</span> </label>
</div>
<div class="dds__form-check dds__form-check-inline"> <label class="dds__form-check-label" for="exampleRadios3"> <input class="dds__form-check-input" type="radio" name="exampleInline" id="exampleRadios3" value="option3" disabled=""> <span>Value 3 (disabled)</span> </label>
</div> </fieldset>

Radio Buttons with Optional Title in Error State

<fieldset> <legend class="dds__mb-1"> Sample Standard Radio Buttons Title (Optional) </legend>
<div class="dds__alert-styling"> <div class="dds__form-check"> <label class="dds__form-check-label" for="errorRadio1"> <input class="dds__form-check-input" type="radio" name="exampleRadios" id="errorRadio1" value="standardopt1"> <span>Value 1</span> </label>
</div>
<div class="dds__form-check"> <label class="dds__form-check-label" for="errorRadio2"> <input class="dds__form-check-input" type="radio" name="exampleRadios" id="errorRadio2" value="standardopt2"> <span>Value 2 has a lengthy label to test text wrapping</span> </label>
</div>
<div class="dds__form-check dds-radio-button"> <label class="dds__form-check-label" for="exampleDisabledRadio"> <input class="dds__form-check-input" type="radio" name="exampleRadios" id="exampleDisabledRadio" value="option3" disabled=""> <span>Value 3 (disabled)</span> </label>
</div> </div> <div class="dds__invalid-feedback"> Error message goes here. </div> </fieldset>

Radio Buttons Styled as Cards

<div> <div class="dds__radio-btn-wrapper-stroked" data-toggle="dds__button-filter"> <div class="dds__card-stroked dds__filter-item dds__active" tabindex="-1"> <input type="radio" id="RadioButtonStroked1" name="ExampleRadioButtonFilter" value="RadioButtonStroked1" class="dds__btn-input dds__sr-only" checked /> <label class="dds__card-label-stroked dds__btn-filter" for="RadioButtonStroked1" data-filter-value="Option A"> <div class="dds__card-label-container"><p class="dds__card-title-stroked">Option A</p></div> </label> </div> <div class="dds__card-stroked dds__filter-item" tabindex="-1"> <input type="radio" id="RadioButtonStroked2" name="ExampleRadioButtonFilter" value="RadioButtonStroked2" class="dds__btn-input dds__sr-only" /> <label class="dds__card-label-stroked dds__btn-filter" for="RadioButtonStroked2" data-filter-value="Option B"> <div class="dds__card-label-container"> <p class="dds__card-title-stroked">Option B</p> <p class="dds__card-txt-stroked-supporting">Supporting text</p> </div> </label> </div> <div class="dds__card-stroked dds__filter-item" tabindex="-1"> <input type="radio" id="RadioButtonStroked3" name="ExampleRadioButtonFilter" value="RadioButtonStroked3" class="dds__btn-input dds__sr-only" /> <label class="dds__card-label-stroked dds__btn-filter" for="RadioButtonStroked3" data-filter-value="Option C"> <div class="dds__card-label-container"> <p class="dds__card-title-stroked">Option C</p> <p class="dds__card-txt-stroked-secondary">Marketing text</p> <p class="dds__card-txt-stroked-supporting">Supporting text</p> </div> </label> </div> <div class="dds__card-stroked dds__filter-item" tabindex="-1"> <input type="radio" id="RadioButtonStroked4" name="ExampleRadioButtonFilter" value="RadioButtonStroked4" class="dds__btn-input dds__sr-only" /> <label class="dds__card-label-stroked dds__btn-filter" for="RadioButtonStroked4" data-filter-value="Option D"> <div class="dds__card-label-container"> <img src="//uicore.dellcdn.com/site/1.6.1/5c76c529d2ffcf0165d4365b/5dd2dd661e22cb7de5b67ce4_card-marketing-1.png" alt="" class="dds__card-img-stroked" /> <p class="dds__card-title-stroked">Option D</p> <p class="dds__card-txt-stroked-supporting">Supporting text</p> </div> </label> </div> <div class="dds__card-stroked dds__filter-item" tabindex="-1"> <input type="radio" id="RadioButtonStroked5" name="ExampleRadioButtonFilter" value="RadioButtonStroked5" class="dds__btn-input dds__sr-only" /> <label class="dds__card-label-stroked dds__btn-filter" for="RadioButtonStroked5" data-filter-value="Option E"> <div class="dds__card-label-container"> <img src="//uicore.dellcdn.com/site/1.6.1/5c76c529d2ffcf0165d4365b/5dd2dd661e22cb7de5b67ce4_card-marketing-1.png" alt="" class="dds__card-img-stroked" /> <p class="dds__card-title-stroked">Option E</p> <p class="dds__card-txt-stroked-secondary">Marketing text</p> <p class="dds__card-txt-stroked-supporting">Supporting text</p> </div> </label> </div> <div class="dds__card-stroked dds__filter-item dds__disabled" tabindex="-1"> <input type="radio" id="RadioButtonStroked6" name="ExampleRadioButtonFilter" value="RadioButtonStroked6" class="dds__btn-input dds__sr-only" /> <label class="dds__card-label-stroked dds__btn-filter" for="RadioButtonStroked6" data-filter-value="Option F"> <div class="dds__card-label-container"> <img src="//uicore.dellcdn.com/site/1.6.1/5c76c529d2ffcf0165d4365b/5dd2dd661e22cb7de5b67ce4_card-marketing-1.png" alt="" class="dds__card-img-stroked" /> <p class="dds__card-title-stroked">Option F</p> <p class="dds__card-txt-stroked-secondary">Marketing text</p> <p class="dds__card-txt-stroked-supporting">Supporting text</p> </div> </label> </div> </div>
</div>

No items found.

No items found.

Heading

No items found.

Usage

Each radio button group requires a minimum of 2 options to choose from.

Use a Select component if there are more than 6 options to choose from.

Only one option within a radio button group may be selected at one time, and one must be selected by the user (otherwise don't use radio buttons).

Although one of the options in a radio button group may be selected by default, it's recommended that none of them be selected by default so that users are more aware of the decision. Setting a default value can also discourage users from making conscious decisions, seem pushy, or alienate users who don’t fit into your assumptions.

Some radio button options may begin disabled until selections are made elsewhere on the page, while others may become disabled as the result of selections elsewhere. In such cases, the corresponding selection should be in view at the same time as the radio button group.

Radio buttons that are listed vertically are easier to read than those that are listed horizontally. Horizontal listings can make it difficult to tell which label pertains to which radio button.

Selecting a radio button should not trigger unexpected changes in context, such as causing significant changes to the page content or opening a new window

Keyboard Operation

  • Tab or Shift + Tab = Move focus into and out of the radio group. When focus moves into a radio group, if a radio button is checked, focus is set on the checked button. If none of the radio buttons are checked, focus is set on the first radio button in the group. In some browsers, if none of the radio buttons are selected, moving focus into the radio group with Shift + Tab will place focus on the last radio button instead of the first radio button.
  • Space = Checks the focused radio button if it is not already checked.
  • Right Arrow or Down Arrow = Move focus to the next radio button in the group, uncheck the previously focused button, and check the newly focused button. If focus is on the last button, focus moves to the first button.
  • Left Arrow or Up Arrow = Move focus to the previous radio button in the group, uncheck the previously focused button, and check the newly focused button. If focus is on the first button, focus moves to the last button.

Do's and Don'ts

Common Button Labels and Usage

Title case, 2-3 words maximum.
Do not combine actions in a label (exception: "Customize & Buy").
If standard labels don't fit the button's purpose, align label with the task the user is attempting.

Please refer to the Dell Technologies branding website, https://brand.delltechnologies.com/faq/#voice, for further information regarding call-to-action labels and usage.

Button Label:
Corresponding Action:
Add to Cart
Search
Cancel
Save
Edit
Delete
Continue
Next/Previous
Submit
Select
Sign In/Sign Out
View Details
Ok/Cancel
Learn More
Close
Takes users to Cart page, with item added
Used for search buttons
Takes users back to entry point for a task
Used to save an item
Navigates users to change an item
Deletes an item on the page, usually with a verification step
Used as progression
Used as forward and backward navigation (Next is primary, Previous is secondary)
Used to submit a task or info
Used for choosing items in a task flow
Authentication standard, for consistency do not use Log In/Log Out or Signin/Signout
Used instead of “Select” in cases of product details or within learn content
For use in modal verification steps when more specific CTAs will not fit due to space
Used to link users to more learning content or contextual help
Used within modal windows

Accessibility

The A11Y Style Guide has excellent examples of markup for radio buttons.

The W3C Web Accessibility Initiative (WAI) develops standards and support materials to help you understand and implement accessibility.

Please follow the best practices for a radio group from WAI-ARIA authoring practices 1.1.

Please also refer to these recommendations for a radiogroup from WAI-ARIA 1.1.

You may refer to this example of a radio group using roving tabindex or this radio group using aria-activedescendant from WAI-ARIA practices 1.1.

You may also refer to these tutorials for form concepts from Web Accessibility Tutorials.

You may also refer to this article about creating accessible forms from WebAIM.