JSFiddle - React, Tailwind, and code Playground
by Sharmi
HTML
<ul id="1" name="1" class="tg-list SpotTypeChk">
<li class="tg-list-item">
<input id="PP" name="PP" type="checkbox" class="tgl tgl-flip" checked />
<label data-tg-off="PP" data-tg-on="PP" for="P" class="tgl-btn"></label>
</li>
</ul>
<ul id="1" name="1" class="tg-list SpotTypeChk">
<li class="tg-list-item">
<input id="PYO_" name="PYO_" type="checkbox" class="tgl tgl-flip" checked />
<label data-tg-off="PYO1" data-tg-on="PYO1" for="PYO_" class="tgl-btn"></label>
</li>
</ul>
<ul id="1" name="1" class="tg-list SpotTypeChk">
<li class="tg-list-item">
<input id="PYO12" name="PYO12" type="checkbox" class="tgl tgl-flip" checked />
<label data-tg-off="PYO12" data-tg-on="PYO12" for="PYO12" class="tgl-btn"></label>
</li>
</ul>
CSS
ul,
li {
list-style: none;
margin: 0;
padding: 0;
}
.tg-list {
text-align: center;
display: flex;
align-items: center;
}
.tg-list-item {
margin: 0 1px;
}
.tgl {
display: none;
}
.tgl,
.tgl:after,
.tgl:before,
.tgl *,
.tgl *:after,
.tgl *:before,
.tgl + .tgl-btn {
box-sizing: border-box;
}
.tgl::selection,
.tgl:after::selection,
.tgl:before::selection,
.tgl *::selection,
.tgl *:after::selection,
.tgl *:before::selection,
.tgl + .tgl-btn::selection {
background: none;
}
.tgl + .tgl-btn {
outline: 0;
display: block;
width: 30px;
height: 40px;
position: relative;
cursor: pointer;
user-select: none;
}
.tgl + .tgl-btn:after,
.tgl + .tgl-btn:before {
position: relative;
display: block;
content: "";
width: 50%;
height: 100%;
}
.tgl + .tgl-btn:after {
left: 0;
}
.tgl + .tgl-btn:before {
display: none;
}
.tgl:checked + .tgl-btn:after {
left: 50%;
}
.tgl-light + .tgl-btn {
background: #f0f0f0;
border-radius: 2em;
padding: 2px;
transition: all .4s ease;
}
.tgl-light + .tgl-btn:after {
border-radius: 50%;
background: #fff;
transition: all .2s ease;
}
.tgl-light:checked + .tgl-btn {
background: #9FD6AE;
}
.tgl-ios + .tgl-btn {
background: #fbfbfb;
border-radius: 2em;
padding: 2px;
transition: all .4s ease;
border: 1px solid #e8eae9;
}
.tgl-ios + .tgl-btn:after {
border-radius: 2em;
background: #fbfbfb;
transition: left 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), padding 0.3s ease, margin 0.3s ease;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 4px 0 rgba(0, 0, 0, 0.08);
}
.tgl-ios + .tgl-btn:hover:after {
will-change: padding;
}
.tgl-ios + .tgl-btn:active {
box-shadow: inset 0 0 0 2em #e8eae9;
}
.tgl-ios + .tgl-btn:active:after {
padding-right: .8em;
}
.tgl-ios:checked + .tgl-btn {
background: #86d993;
}
.tgl-ios:checked + .tgl-btn:active {
box-shadow: none;
}
.tgl-ios:checked + .tgl-btn:active:after {
margin-left: -.8em;
}
.tgl-skewed + .tgl-btn {
overflow:...