JSFiddle - React, Tailwind, and code Playground

by kthornbloom

HTML

<div class="input-group">
  <input type="checkbox" id="a">
  <label for="a">The content goes here</label>
</div>

<div class="input-group">
  <input type="checkbox" id="b">
  <label for="b">The content goes here</label>
</div>

SCSS

label {
  border: 2px solid grey;
  padding: 1em;
  display: block;
  width: 200px;
  margin: 10px;
}

input[type="checkbox"]{
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

input[type="checkbox"]:focus-visible ~ label{
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px blue;
 }

input[type="checkbox"]:checked ~ label{
  border: 2px solid red;
}

body {
  padding: 1em;
}