JSFiddle - React, Tailwind, and code Playground
by Gady Touitou
HTML
<form>
<input id="ckbx" type="checkbox" value="map_one">
</form>
CSS
hr {
background-color: #ccc;
border: 0;
height: 1px;
margin: 8px;
}
input[type="checkbox"] {
appearance: none;
background-color: #fafafa;
border: 1px solid #d3d3d3;
border-radius: 26px;
cursor: pointer;
height: 28px;
position: relative;
transition: border .25s .15s, box-shadow .25s .3s, padding .25s;
width: 44px;
vertical-align: top;
-webkit-appearance: none;
}
input[type="checkbox"]:after {
background-color: white;
border: 1px solid #d3d3d3;
border-radius: 24px;
box-shadow: inset 0 -3px 3px rgba(0, 0, 0, 0.025), 0 1px 4px rgba(0, 0, 0, 0.15), 0 4px 4px rgba(0, 0, 0, 0.1);
content:'';
display: block;
height: 24px;
left: 0;
position: absolute;
right: 16px;
top: 0;
transition: border .25s .15s, left .25s .1s, right .15s .175s;
}
input[type="checkbox"]:checked {
border-color: #53d76a;
box-shadow: inset 0 0 0 13px #53d76a;
padding-left: 18px;
transition: border .25s, box-shadow .25s, padding .25s .15s;
}
input[type="checkbox"]:checked:after {
border-color: #53d76a;
left: 16px;
right: 0;
transition: border .25s, left .15s .25s, right .25s .175s;
}