JSFiddle - React, Tailwind, and code Playground

by Dörnesz Tamás

HTML

<form>
<input type="checkbox" id="ch1"><label for="ch1"></label>
<input type="checkbox" id="ch2" checked><label for="ch2"></label>
<input type="checkbox" id="ch3"><label for="ch3"></label>
</form>

CSS

form input[type="checkbox"]{
  display:none;
}
form label::before { 
 content: "";
 background-image: url('data:image/svg+xml;utf8,<svg fill="rgb(128,128,128)" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/></svg>');
 width:24px;
 height:24px;
 display:inline-block;
}
form input[type="checkbox"]:checked + label::before {
 content: "";
 background-image: url('data:image/svg+xml;utf8,<svg fill="rgb(128,128,128)" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>');
 width:24px;
 height:24px;
 display:inline-block;
}