871 0 0 0
Last Updated : 2025-04-28 21:44:58
You can only add the .min.css & .min.js files from the following library to your head code of the page and you will have a toggle button from a check-box. The only thing you need to do for a check-box to be turned into a toggle button is to add the ( data-toggle="toggle" ) attribute to it. Reference : https://www.bootstraptoggle.com/
<!-- In head tag -->
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
<!-- In body tag -->
<input type="checkbox" checked data-toggle="toggle">
<!-- In turned off by default -->
<input type="checkbox" data-toggle="toggle">
<!-- to turn it on or off just add checked attibute -->
Reference: https://www.bootstraptoggle.com/