JSFiddle - React, Tailwind, and code Playground
HTML
<button class="run-css">CSS slideToggle</button>
<div class="cont">Toggle this div</div>
CSS
.cont {
width: 100px;
height: 100px;
border: 1px #CCC solid;
background-color: #EEE;
padding: 5px;
-webkit-transition: height .3s linear, padding-top .3s linear,
padding-bottom .3s linear, border-width .3s linear;
}
.toggled {
overflow: hidden;
padding-top: 0;
padding-bottom: 0;
height: 0;
border-width: 0;
}
JavaScript
$('.run-css').click(function() {
$('.cont').toggleClass('toggled');
});