JSFiddle - React, Tailwind, and code Playground
HTML
<div class="box">
<button id="expander">click to expand</button>
<p>there is many content with unknown height...</p>
<p>second paragraph</p>
<p>third paragraph</p>
<p>fourth paragraph</p>
</div>
CSS
.box {
width: 300px;
max-height: 30px;
overflow: hidden;
background: #aaa;
-webkit-transition: max-height 400ms ease-in-out;
-moz-transition: max-height 400ms ease-in-out;
-ms-transition: max-height 400ms ease-in-out;
-o-transition: max-height 400ms ease-in-out;
transition: max-height 400ms ease-in-out;
}
.box.open {
max-height: 999px;
}
JavaScript
$('#expander').on('click', function () {
$('.box').toggleClass('open')
});