JSFiddle - React, Tailwind, and code Playground
HTML
<label class="checkbox">
<input type="checkbox" />
<span>Lorem ipsum</span>
</label>
CSS
.checkbox {
cursor: pointer;
position: relative;
}
.checkbox input[type="checkbox"] {
display: none;
}
.checkbox span {
font-size: 20px;
}
.checkbox span:before {
content: "";
display: inline-block;
width: 25px;
height: 25px;
border: 2px solid rgba(0, 0, 0, 0.5);
border-radius: 5px;
margin: 5px 5px 0 20px;
}
.checkbox span:after {
content: "";
display: none;
position: absolute;
left: 30px;
top: -9px;
width: 5px;
height: 13px;
border-bottom: 4px solid white;
border-right: 4px solid white;
border-radius: 1px;
transform: rotate(30deg);
}
.checkbox input[type="checkbox"]:checked + span:before {
border-color: #03a9f4;
background-color: #03a9f4;
}
.checkbox input[type="checkbox"]:checked + span:after {
display: inline-block;
}