JSFiddle - React, Tailwind, and code Playground

by flek

HTML

<input type="checkbox">

CSS

html {
    background-color: #fff;
    background-image: -webkit-linear-gradient(hsla(0,0%,0%,.1), hsla(0,0%,100%,.1));
    box-shadow: inset 0 0 100px hsla(0,0%,0%,.1);
    height: 100%;
}
input[type="checkbox"] {
    background-image: -webkit-linear-gradient(rgba(0,0,0,.2), rgba(0,0,0,.1)),
                      -webkit-linear-gradient(left, #e5e5e5 50%, #29cc36 50%);
    background-size: 100% 100%, 200% 100%;
    background-position: 0 0, 5px 0;
    border-radius: 25px;
    box-shadow: inset 0 1px 5px 0 rgba(0,0,0,.3),
                inset 0 1px 0 0 rgba(0,0,0,.25),
                inset 0 -1px 0 0 rgba(0,0,0,.15),
                inset 1px 0 0 0 rgba(0,0,0,.15),
                inset -1px 0 0 0 rgba(0,0,0,.15),
                0 1px 0 0 rgba(255,255,255,0.75);
    cursor: pointer;
    height: 10px;
    left: 50%;
    margin: -5px -10px;
    padding-right: 10px;
    position: absolute;
    top: 50%;
    width: 20px;
    -webkit-appearance: none;
    -webkit-transition: .15s;
}
input[type="checkbox"]:after {
    background-color: #fff;
    background-image: -webkit-linear-gradient(rgba(0,0,0,.1), rgba(0,0,0,.1));
    border-radius: 25px;
    box-shadow: inset 0 1px 0 0 rgb(255,255,255),
                inset 0 -1px 0 0 rgba(0,0,0,.08),
                    0 0 0 1px rgba(0,0,0,0.6);
    content: '';
    display: block;
    height: 10px;
    left: 0;
    position: relative;
    top: 0;
    width: 10px;
}
input[type="checkbox"]:checked {
    background-position: 0 0, 15px 0;
    padding-left: 10px;
    padding-right: 0;
}