A radio button is a type of form input that is used within a group of options where only option can be selected. The following are custom input styles.
Examples
Usage
Rules
- Include matching
for
andid
values unique to each label and radio button pair to associate the two - Use radio buttons to present a set of options, where only one option can be selected at a time
- For sets with three or less short options the horizontal layout may be more appropriate
- For sets with longer labels or more than 3 options use the vertically stacked layout
Constraints
- When possible, keep the label short to more easily compare options when used within a set
- Only use a
fieldset
withlegend
to group associated inputs (e.g. multiple address inputs or credit card month/year inputs) or a set of radios or checkboxes. Some assistive tools will read the contents of the legend before each nested input to maintain context for a user. The above examples use alegend
within thefieldset
. Thelegend
is styled like alabel
.
Principles
- Radio buttons allow a user to indicate their choice by selecting one option from a set
Accessibility
- Use
for="IDReference"
to associate the label with the corresponding inputid="IDReference"
Class Names
form-group Required |
Use on the parent |
c-input Required |
Use on the |
c-radio Required |
Used with |
form-group-spacer Modifier |
Use with |
c-inputs-stacked Modifier |
Custom checkboxes are inline-block by default, if you need them to stack use this on the parent |
- Last updated April 2, 2018
- Authorable - Yes
- Core - Radio Buttons