JSFiddle - React, Tailwind, and code Playground
HTML
<div class="spoiler-title closed">Показать текcт</div>
<div class="spoiler-body">text</div>
CSS
.opened {
color:green;
cursor:pointer;
}
.closed {
color:green;
cursor:pointer;
}
.spoiler-title {width:15px;}
JavaScript
$('.spoiler-body').hide();
$('.spoiler-title').click(function(){
$(this).toggleClass('closed').toggleClass('opened').next().slideToggle(500);
if($(this).hasClass('opened')) {
$(this).html('▲');
}
else {
$(this).html('▼');
}
});