JSFiddle - React, Tailwind, and code Playground

HTML

<button id="close">close</button>
<div id="textselector-body">
    a<br/>
    b<br/>
    c<br/>
</div>

CSS

#textselector-body{
    width:400px;
    height:auto;
    border:1px #000 solid;
    margin:0;
    padding:0;
    overflow:hidden;
}

JavaScript

$("#close").click(function(){
    var txt=$(this).text()=='Open'?'Close':'Open';
    $("#textselector-body").animate({height:'toggle'}, function(){
          $("#close").text(txt);
    });
        
});