JSFiddle - React, Tailwind, and code Playground

HTML

<input id="myChk" type="checkbox" />
<label for="myChk">&nbsp</label>

CSS

input[type='checkbox'] {
    outline: 0;
    user-select: none;
    display: inline-block;
    position: absolute;
    opacity: 0;
}
input[type='checkbox'] + label {
    display:inline-block;
    width:20px;
    height:20px;
    background-color:blue
}
input[type='checkbox']:checked + label {
    background-color:red
}