JSFiddle - React, Tailwind, and code Playground
by Pritesh Patel
HTML
<div class="nt-radio-group">
<input type="checkbox" class="nt-radio" id="checkbox1">
<label for="checkbox1" class="nt-radio-label">Kosher</label>
</div>
CSS
.nt-radio:checked,
.nt-radio:not(:checked) {
position: absolute;
left: -9999px;
}
.nt-radio:checked + .nt-radio-label,
.nt-radio:not(:checked) + .nt-radio-label {
position: relative;
padding-left: 36px;
cursor: pointer;
line-height: 20px;
display: inline-block;
}
.nt-radio:checked + .nt-radio-label:before,
.nt-radio:not(:checked) + .nt-radio-label:before {
content: "";
position: absolute;
left: 0;
top: 0;
width: 16px;
height: 16px;
border: 1px solid #68a51c;
border-radius: 2px;
background: #fff;
}
.nt-radio:checked + .nt-radio-label:after,
.nt-radio:not(:checked) + .nt-radio-label:after {
content: "";
/* width: 10px;
height: 10px;
background: #68a51c;
position: absolute;
top: 4px;
left: 4px; */
/* border-radius: 100%; */
-webkit-transition: all 0.2s ease;
transition: all 0.2s ease;
position: absolute;
left: 5px;
top: 2px;
width: 5px;
height: 9px;
border: solid red;
border-width: 0 2px 2px 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.nt-radio:checked + label:before{
background-color: blue;
}
.nt-radio:not(:checked) + .nt-radio-label:after {
opacity: 0;
/* -webkit-transform: scale(0);
transform: scale(0); */
}
.nt-radio:checked + .nt-radio-label:after {
opacity: 1;
/* -webkit-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-transition: all 0.2s ease;
transition: all 0.2s ease; */
}
.nt-radio:disabled + .nt-radio-label:after,
.nt-radio:not(:checked):disabled + .nt-radio-label:after {
background:#ccc;
}
.nt-radio:disabled + .nt-radio-label:before,
.nt-radio:not(:checked):disabled + .nt-radio-label:before {
border: 2px solid #ccc;
}