JSFiddle - React, Tailwind, and code Playground

by Jim_Toth

HTML

<div class="round">
  <input type="checkbox" id="checkbox" />
  <label for="checkbox"></label>
</div>

CSS

.round {
  position: relative;
}

.round label {
  background-color: #fff;
  border: 4px solid #008ec2;
  border-radius: 50%;
  cursor: pointer;
  height: 15px;
  left: 0;
  position: absolute;
  top: 0;
  width: 15px;
  transition: 0.25s;
}

.round label:after {
  border: 2px solid #fff;
  border-top: none;
  border-right: none;
  content: "";
  height: 5px;
  left: 1px;
  opacity: 0;
  position: absolute;
  top: 3px;
  transform: rotate(-45deg);
  width: 12px;
}

.round input[type="checkbox"] {
  visibility: hidden;
}

.round input[type="checkbox"]:checked + label {
  background-color: #008ec2;
  border-color: #008ec2;
}

.round input[type="checkbox"]:checked + label:after {
  opacity: 1;
}