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 300ms cubic-bezier(0, .6, .6, 1);
-moz-transition: max-height 300ms cubic-bezier(0, .6, .6, 1);
-ms-transition: max-height 300ms cubic-bezier(0, .6, .6, 1);
-o-transition: max-height 300ms cubic-bezier(0, .6, .6, 1);
transition: max-height 300ms cubic-bezier(0, .6, .6, 1);
}
.box.open {
max-height: 999px;
-webkit-transition: max-height 400ms ease-in;
-moz-transition: max-height 400ms ease-in;
-ms-transition: max-height 400ms ease-in;
-o-transition: max-height 400ms ease-in;
transition: max-height 400ms ease-in;
}
JavaScript
$('#expander').on('click', function () {
$('.box').toggleClass('open')
});