Bootstrap 4 Checkbox
Bootstrap 4 Checkbox form component
Bootstrap Checkbox is a component used for allowing a user to make a multiple choice. Broadly used in the forms and surveys.
Basic Bootstrap 4 version
<!-- Default unchecked -->
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="defaultUnchecked">
<label class="custom-control-label" for="defaultUnchecked">Default unchecked</label>
</div>
<!-- Default checked -->
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="defaultChecked2" checked>
<label class="custom-control-label" for="defaultChecked2">Default checked</label>
</div>
Above is an example template for a Checkbox in the Bootstrap 4 version based on jQuery. V4 is an older version of Bootstrap and we discourage implementing it in new projects.
Below you will find the same component but in the latest, more modern Bootstrap 5. We encourage you to use the v5 version instead, the v5 is more lightweight, more reliable and based on pure JavaScript instead of jQuery.
This page only compares the two version, you can find full documentation - with multiple options & API details via one of the links below:
Bootstrap v5 - full documentation
Bootstrap v4 - full documentation
Basic Bootstrap 5 version
<!-- Default checkbox -->
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault" />
<label class="form-check-label" for="flexCheckDefault">Default checkbox</label>
</div>
<!-- Checked checkbox -->
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="flexCheckChecked" checked/>
<label class="form-check-label" for="flexCheckChecked">Checked checkbox</label>
</div>