JSFiddle - React, Tailwind, and code Playground

HTML

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

CSS

.checkbox-button label {
  width: 150px;
  padding: 1em;
  background: #eee;
  border: 1px solid #888;
  display: block;
  text-align: center;
  cursor: pointer;
}

/* Masque la checkbox */

.checkbox-button input {
  display: none;
}

/* Change la couleur de <label> quand la checkbox est cochée */

.checkbox-button input:checked~label {
  background: darkseagreen;
}

/* Controle le texte qui apparais dans le bouton */

.checkbox-button label:before {
  content: "OFF";

}

.checkbox-button input:checked~label:before {
  content: "ON";
}