JSFiddle - React, Tailwind, and code Playground
by Pritesh Patel
HTML
<div class="nt-radio-group">
<input type="checkbox" id="checkboxx1" class="nt-radio">
<label for="checkboxx1" class="nt-radio-label">Vegetarian</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: 100%; */
background: #fff;
border-radius: 2px;
}
.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: 5px;
left: 5px;
/* border-radius: 100%; */
-webkit-transition: all 0.2s ease;
transition: all 0.2s ease;
border: solid white;
border-width: 2px 3px 3px 2px;
}
.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: scale(1);
transform: scale(1);
}
.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;
}