JSFiddle - React, Tailwind, and code Playground
HTML
<label><input type="checkbox"/> checkbox</label>
CSS
label {
padding-left: 20px;
}
label.active {
background-position: 0-40px;
}
label input {
display: none;
}
label {
...
JavaScript
$('label').on('click', function() {
if ( $(this).find('input:checked').length ) {
$(this).addClass('active');
} else {
$(this).removeClass('active');
}
});