JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/js/materialize.min.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<input type="checkbox" id="test" checked/>
<label for="test" id="check-label">Red</label>

JavaScript

$(document).ready(function() {

  $('#check-label').click(function() {
  	alert("clicked");
  	var checkbox = $("#test");
    if (!$(checkbox).is(':checked'))
      $(checkbox).prop('indeterminate', true);
  });

});