JSFiddle - React, Tailwind, and code Playground

HTML

<button id="slidein">SlideIn</button><button id="slideout">SlideOut</button>
<div></div>

CSS

div{width:0px; height:100px; background:#000;}

JavaScript

$('#slidein').click(function(){
    $('div').stop().animate({
        'width':'50%'
    }, 500);
});

$('#slideout').click(function(){
    $('div').stop().animate({
        'width':'0px'
    }, 500);
});