Checks and radios

Create consistent cross-browser and cross-device checkboxes and radios with our completely rewritten checks component.

On this page

Approach

Browser default checkboxes and radios are replaced with the help of FormCheck, a series of classes for both input types that improves the layout and behavior of their HTML elements, that provide greater customization and cross browser consistency.

Checkboxes are for selecting one or several options in a list, while radios are for selecting one option from many.

Structurally, our FormCheckInputs and FormCheckLabels are sibling elements as opposed to an FormCheckInput within a FormCheckLabel.

This is slightly more verbose as you must specify id and for attributes to relate the FormCheckInput and FormCheckLabel.

We use the sibling selector (~) for all our FormCheckInput states, like :checked or :disabled.

When combined with the .form-check-label class, we can easily style the text for each item based on the FormCheckInput's state.

Our checks use custom Bootstrap icons to indicate checked or indeterminate states.

Checks

Checkbox 1
false
Checkbox 2
true
vue

Custom value Model Binding

Checkbox 1
ng
Checkbox 2
ok
vue

Indeterminate

Checkboxes can utilize the indeterminate attributes when manually set.

vue

Disabled

Add the disabled attribute and the associated FormCheckLabels are automatically styled to match with a lighter color to help indicate the input's state.

vue

Radios

Selected Value
two
vue

Disabled

Add the disabled attribute and the associated FormCheckLabels are automatically styled to match with a lighter color to help indicate the input's state.

vue

Switches

A switch has the markup of a custom checkbox but uses the switch class to render a toggle switch. Consider using role="switch" to more accurately convey the nature of the control to assistive technologies that support this role. In older assistive technologies, it will simply be announced as a regular checkbox as a fallback. Switches also support the disabled attribute.

Checkbox 1
false
Checkbox 2
true
Checkbox 3
false
vue

Default (stacked)

By default, any number of checkboxes and radios that are immediate sibling will be vertically stacked and appropriately spaced with FormCheck.

vue
vue

Inline

Group checkboxes or radios on the same horizontal row by adding inline to any FormCheck.

vue

Reverse

Put your checkboxes, radios, and switches on the opposite side with the reverse modifier class.

vue

Without labels

Omit the wrapping FormCheck for checkboxes and radios that have no label text.

Remember to still provide some form of accessible name for assistive technologies (for instance, using aria-label).

vue

Toggle buttons

Create button-like checkboxes and radio buttons by using .btn styles rather than .form-check-label on the FormCheckLabel,elements.

These toggle buttons can further be grouped in a button group if needed.

Checkbox toggle buttons

Toggle 1
false
Toggle 2
true
vue
Toggle 1
false
Toggle 2
true
vue

Radio toggle buttons

Toggle 1
one
vue
Toggle 1
one
vue

Outlined styles

Different variants of .btn, such at the various outlined styles, are supported.

vue
On this page