⭐️ If you like this product, please support us by starring our GitHub repository! Star ⭐️
GitHub Download Get AdminKit Pro

Bootstrap 5 Toggle Switch

Toggle Switch

A Bootstrap switch component is a simple element which can be used to toggle between two options. Switches are commonly used to toggle on/off buttons.

Toggle Switch

Example

A switch has the same markup of a checkbox with the exception of the .form-switch class to render a toggle switch.

<div class="form-check form-switch">
  <input class="form-check-input" type="checkbox" id="flexSwitchCheckDefault">
  <label class="form-check-label" for="flexSwitchCheckDefault">Default switch checkbox input</label>
</div>
<div class="form-check form-switch">
  <input class="form-check-input" type="checkbox" id="flexSwitchCheckChecked" checked>
  <label class="form-check-label" for="flexSwitchCheckChecked">Checked switch checkbox input</label>
</div>

Disabled

Switches also support the disabled attribute.

<div class="form-check form-switch">
  <input class="form-check-input" type="checkbox" id="flexSwitchCheckDisabled" disabled>
  <label class="form-check-label" for="flexSwitchCheckDisabled">Disabled switch checkbox input</label>
</div>
<div class="form-check form-switch">
  <input class="form-check-input" type="checkbox" id="flexSwitchCheckCheckedDisabled" checked disabled>
  <label class="form-check-label" for="flexSwitchCheckCheckedDisabled">Disabled checked switch checkbox input</label>
</div>