JSFiddle - React, Tailwind, and code Playground
by Prajeesh_PR
HTML
<label class="containercheck">
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
CSS
.containercheck {
position: relative;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Hide the browser's default checkbox */
.containercheck input {
position: absolute;
opacity: 0;
cursor: pointer;
height: 0;
width: 0;
}
/* Create a custom checkbox */
.checkmark {
position: absolute;
height: 16px;
width: 16px;
background-color: white;
border: 0.5px solid #E1E2E4;
}
/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
content: "";
position: absolute;
display: none;
left: 5px;
top: 0px;
width: 4px;
height: 10px;
border: solid #33CEFA;
border-width: 0 2px 2px 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
/* Show the checkmark when checked */
.containercheck input:checked ~ .checkmark:after {
display: block;
}