JSFiddle - React, Tailwind, and code Playground
HTML
<input id="cb1" type="checkbox" onclick="toggle_tristate(this)">
JavaScript
cb1.state = 1
function toggle_tristate(cb) {
cb.state = ++cb.state % 3 // cycle through 0,1,2
if (cb.state == 0) {
cb.indeterminate = true;
cb.checked = true; // after 'indeterminate' the state 'false' follows
}
}