JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<body>
<div class="w3-container">
<br>
<form name="formone" method="post" action="file.php">
<button type="button" onclick="myFunction('Demo1')" class="w3-btn w3-block w3-black w3-left-align">Vehicle</button>
<div id="Demo1" class="w3-container w3-hide">
  <input type="checkbox" name="vehicle" value="Bike"> Bike<br>
  <input type="checkbox" name="car" value="Car"> Car<br>
</div>
<button type="button" onclick="myFunction('Demo1')" class="w3-btn w3-block w3-black w3-left-align">Distance</button>
<div id="Demo2" class="w3-container w3-hide">
  <input type="checkbox" name="distance" value="m"> Metre<br>
  <input type="checkbox" name="distance" value="km"> KM<br>
</div>
<br>
<button type="submit" name="submit">Submit</button>
</form>

</div>

<script>
function myFunction(id) {
    var x = document.getElementById(id);
    if (x.className.indexOf("w3-show") == -1) {
        x.className += " w3-show";
    } else { 
        x.className = x.className.replace(" w3-show", "");
    }
}
</script>