JSFiddle - React, Tailwind, and code Playground
HTML
<link rel=”stylesheet” href=”https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css”>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="checkbox checkbox-slider--b-flat">
<label>
<input type="checkbox"><span>Default</span>
</label>
</div>
<div class="checkbox checkbox-slider--b-flat">
<label>
<input type="checkbox" checked=""><span>checked</span>
</label>
</div>
<div class="checkbox checkbox-slider--b-flat">
<label>
<input type="checkbox" disabled=""><span>disabled</span>
</label>
</div>
<div class="checkbox checkbox-slider--b-flat">
<label>
<input type="checkbox" disabled="" checked=""><span>disabled checked</span>
</label>
</div>
</div>
</div>
</div>
CSS
.checkbox-slider--b-flat {
position: relative;
margin-bottom:10px
}
.checkbox-slider--b-flat input {
display: block;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 0%;
height: 0%;
margin: 0 0;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
.checkbox-slider--b-flat input + span {
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.checkbox-slider--b-flat input + span:before {
position: absolute;
left: 0px;
display: inline-block;
}
.checkbox-slider--b-flat input + span > h4 {
display: inline;
}
.checkbox-slider--b-flat input + span {
padding-left: 50px;
}
.checkbox-slider--b-flat input + span:before {
content: "";
height: 24px;
width: 40px;
background: rgba(100, 100, 100, 0.2);
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.8);
transition: background 0.2s ease-out;
}
.checkbox-slider--b-flat input + span:after {
width: 20px;
height: 20px;
position: absolute;
left: 0px;
top: 0;
display: block;
background: #ffffff;
transition: margin-left 0.1s ease-in-out;
text-align: center;
font-weight: bold;
content: "";
}
.checkbox-slider--b-flat input:checked + span:after {
margin-left: 20px;
content: "";
}
.checkbox-slider--b-flat input:checked + span:before {
transition: background 0.2s ease-in;
}
.checkbox-slider--b-flat input + span {
padding-left: 50px;
}
.checkbox-slider--b-flat input + span:before {
border-radius: 20px;
width: 45px;
}
.checkbox-slider--b-flat input + span:after {
background: #ffffff;
content: "";
width: 20px;
border: solid transparent 2px;
background-clip: padding-box;
border-radius: 20px;
}
.checkbox-slider--b-flat input:not(:checked) + span:after {
-webkit-animation: popOut ease-in 0.3s normal;
animation: popOut ease-in 0.3s normal;
}
.checkbox-slider--b-flat input:checked + span:after {
content: "";
margin-left: 20px;
border: solid...