JSFiddle - React, Tailwind, and code Playground
HTML
<p>
<input type="button" value="Click this button and press tab to change focus">
</p>
<div>
<input class="opacity" type="checkbox" id="checkbox1">
<label for="checkbox1">Press space to (un)check</label>
</div>
<div>
<input class="opacity" type="checkbox" id="checkbox2">
<label for="checkbox2">Press space to (un)check</label>
</div>
<div>
<input class="visibility" type="checkbox" id="checkbox3">
<label for="checkbox3">Press space to (un)check</label>
</div>
<div>
<input class="visibility" type="checkbox" id="checkbox4">
<label for="checkbox4">Press space to (un)check</label>
</div>
<div>
<input class="nodisplay" type="checkbox" id="checkbox5">
<label for="checkbox5">Press space to (un)check</label>
</div>
<div>
<input class="nodisplay" type="checkbox" id="checkbox6">
<label for="checkbox6">Press space to (un)check</label>
</div>
CSS
.opacity {
position: absolute;
opacity: 0;
width: 0; /* for internet explorer */
}
.visibility {
visibility: hidden;
}
.nodisplay {
display: none;
}
input[type=checkbox]+label {
font-weight: normal;
}
input[type=checkbox]:checked+label {
font-weight: bold;
}
input[type=checkbox]:focus+label {
border: 1px dotted #000;
}