JSFiddle - React, Tailwind, and code Playground
HTML
<div id="mybutton">Click Here</div>
<div id="mycontainer">
<div id="sub"></div>
</div>
CSS
#mycontainer {
color:#FFF;
background-color: #000;
width: 12px;
height: 12px;
transition: height 100ms, width 100ms ease;
}
#mycontainer.expand {
width: 400px;
height: 400px;
}
#sub {
width:100%; height: 40%; background-color: #555;
}
#mybutton {
}
JavaScript
$("#mybutton").click(function () {
$("#mycontainer").toggleClass("expand");
});