JSFiddle - React, Tailwind, and code Playground

by Abra Cadabra

HTML

<div id="fututed">
    <button>apasa dreq</button>
    <div id="will-expand"></div>
</div>

CSS

#fututed{
    border: 2px solid red;
    width: 500px;
    height: 500px;
    margin: 0 auto;
    position: relative;
}
#will-expand{
    border: 2px solid blue;
    width: 0px;
    right: 500px;
    top: -2px;
    height: 150px;
    position: absolute;
    -webkit-transition: width 1s ease-in-out;
    -moz-transition: width 1s ease-in-out;
    -o-transition: width 1s ease-in-out;
    transition: width 1s ease-in-out;
}

#will-expand.expanded{
    width: 100px;
}

JavaScript

$("button").on('click', function(e){
    e.preventDefault();
    
    $("#will-expand").toggleClass('expanded');
})