JSFiddle - React, Tailwind, and code Playground
HTML
<div id="expandable">
<span>Hover over me</span>
<ul>
<li>List 1</li>
<li>List 2</li>
<li>List 3</li>
<li>List 4</li>
<li>List 5</li>
<li>List 6</li>
</ul>
</div>
CSS
#expandable {
width: 100%; height: 50px;
background: #ddd;
overflow: hidden;
font-family: sans-serif;
font-size: 17px;
}
#expandable.dropped {
background: #666;
color: white;
border-bottom: 1px solid #111 }
#expandable span {
display: block;
width: 100%; height: 50px;
line-height: 50px; text-align: center;
cursor: pointer;
}
#expandable ul {
width: 100%;
line-height: 50px;
}
JavaScript
$("#expandable").click(function() {
var ulHeight = $(this).children("ul").height() + 50;
$(this).stop().animate({"height":ulHeight + "px"},1000).addClass("dropped");
});