You can customize switches by combining different colors and sizes. See the basic example bellow:
<label class="switch">
<input type="checkbox"/>
<span class="switch-slider"></span>
</label>
You can also add outside text.
<label class="switch">
<span class="mr-1">No</span>
<input type="checkbox"/>
<span class="switch-slider"></span>
<span class="ml-1">Yes</span>
</label>
The toggle switch styles follow the contextual bootstrap colors.
<label class="switch switch-to-primary"></label>
<label class="switch switch-to-success"></label>
<label class="switch switch-to-danger"></label>
<label class="switch switch-to-warning"></label>
<label class="switch switch-to-info"></label>
You can also customize the color transition using switch-*
and switch-to-*
.
<label class="switch switch-danger switch-to-success"></label>
Add .switch-sm
for smaller switches or .switch-lg
for larger.
<label class="switch switch-sm"></label>
<label class="switch"></label>
<label class="switch switch-lg"></label>
When adding the disabled boolean attribute to the input
element, the appearance changes to reflect this state.
<label class="switch switch-danger">
<input type="checkbox" checked disabled/>
<span class="switch-slider"></span>
<span class="ml-2">You can't change</span>
</label>