JSFiddle - React, Tailwind, and code Playground
HTML
<span>This is a span.</span>
<button onclick="hide()">hide</button>
<button onclick="show()">show</button>
CSS
span {white-space: nowrap; display: none;}
JavaScript
function hide() {
$("span").animate({width: "hide"}, 2000);
}
function show() {
$("span").animate({width: "show"}, 2000);
}