JSFiddle - React, Tailwind, and code Playground
HTML
<div class='bonus' id="_div">
</div>
<button id="_b">
animate
</button>
CSS
div {
width: 200px;
height: 200px;
background: red;
}
.bonus {
opacity: 0;
transform: translate3d(0, -20%, 0);
transition: all 0.5s ease-out; height: 1px;
}
.active {
opacity: 1;
transform: translate3d(0, 0, 0);
transition: all 0.3s ease-out;
height: 200px;
}
JavaScript
_b.onclick = () => {
_div.classList.toggle('active')
}