JSFiddle - React, Tailwind, and code Playground

by ozzon91

HTML

<input id="c" type="checkbox">

CSS

#c{
    margin: 50px;
}

JavaScript

var checkbox = document.getElementById("c"),
    value = 0;
checkbox.onchange = function() {
    value = ++value % 3;
    checkbox.value = value;
    if (value >= 1) checkbox.checked = true;
    if (value == 2) checkbox.indeterminate = true;
}