Checkbox

Checkbox

Checkboxes toggle an option on or off. Put checkbox on a native <input type="checkbox"> and wrap it in a label.

Playground

Flip a class and watch it change. The markup below follows along.

Color
Size
<label class="label-inline">
  <input type="checkbox" class="checkbox"> Accept terms
</label>

Class names

Class nameTypeDescription
checkboxComponentBase checkbox, primary colored when checked
checkbox-primaryColorPrimary color
checkbox-secondaryColorSecondary color
checkbox-successColorSuccess
checkbox-warningColorWarning
checkbox-infoColorInformational
checkbox-dangerColorDanger
checkbox-smSizeSmall
checkbox-lgSizeLarge
:checkedStateFilled with a check mark
:indeterminateStateFilled with a dash; set `indeterminate` from JS
:disabledStateDimmed and not interactive

Checkbox

<label class="label-inline">
  <input type="checkbox" class="checkbox"> Accept terms
</label>

Colors

<label class="label-inline"><input type="checkbox" class="checkbox checkbox-primary" checked> Primary</label>
<label class="label-inline"><input type="checkbox" class="checkbox checkbox-secondary" checked> Secondary</label>
<label class="label-inline"><input type="checkbox" class="checkbox checkbox-info" checked> Info</label>
<label class="label-inline"><input type="checkbox" class="checkbox checkbox-success" checked> Success</label>
<label class="label-inline"><input type="checkbox" class="checkbox checkbox-warning" checked> Warning</label>
<label class="label-inline"><input type="checkbox" class="checkbox checkbox-danger" checked> Danger</label>

Sizes

Medium is the default; there is no checkbox-md class.

<label class="label-inline"><input type="checkbox" class="checkbox checkbox-sm" checked> Small</label>
<label class="label-inline"><input type="checkbox" class="checkbox" checked> Medium</label>
<label class="label-inline"><input type="checkbox" class="checkbox checkbox-lg" checked> Large</label>

Checked

<label class="label-inline"><input type="checkbox" class="checkbox"> Unchecked</label>
<label class="label-inline"><input type="checkbox" class="checkbox" checked> Checked</label>

Disabled

<label class="label-inline"><input type="checkbox" class="checkbox" disabled> Disabled</label>
<label class="label-inline"><input type="checkbox" class="checkbox" checked disabled> Disabled checked</label>

Group

Notify me about

<fieldset>
  <legend>Notify me about</legend>
  <label class="label-inline"><input type="checkbox" class="checkbox" name="checkbox-ex6-notify" value="mentions" checked> Mentions</label><br>
  <label class="label-inline"><input type="checkbox" class="checkbox" name="checkbox-ex6-notify" value="replies"> Replies</label><br>
  <label class="label-inline"><input type="checkbox" class="checkbox" name="checkbox-ex6-notify" value="digest"> Weekly digest</label>
</fieldset>