A checkbox is a type of form input that can be used within a group of options where none, one or all options can be selected. It can also be used in a single instance. The following are custom input styles.
Examples
Usage
Rules
- Include matching
for
andid
values unique to each label and checkbox pair to associate the two - Use checkboxes to present a set of options, where none, one, or multiple options can be selected at a time
- Alternately use a checkbox in a single instance to select/unselect the option
- 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
- Checkboxes allow a user to select one or more option to indicate their choice, preference or agreement
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-checkbox Required |
Used with |
form-group-spacer Modifier |
Use with |
c-checkbox-sm Modifier |
Used 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 - Checkboxes