JSFiddle - React, Tailwind, and code Playground

HTML

<fieldset>
  <legend class="hide">Tags</legend>
  <div>
      <label>
        <input type="checkbox" name="col" value="summary" checked="checked" />
        Name
      </label>
      <label>
        <input type="checkbox" name="col" value="lastname" />
        LastName
      </label>
  </div>
</fieldset>

CSS

.hide:after{
    content: " >";
}

.show:after{
    content: " <";
}

JavaScript

$(function(){
    $('legend').click(function(){  
        $(this).nextAll('div').toggle();
        $(this).hasClass('hide')?($(this).attr("class", "show")):($(this).attr("class", "hide"));
    });
})