JSFiddle - React, Tailwind, and code Playground

HTML

<button class='toggle-button switch-on'>Test</button>
<div id="color-list">Container Contents</div>

CSS

#color-list{display:none;}

JavaScript

$(document).ready(function(){ 

    $('.toggle-button').click(function(event){
      
if($(this).hasClass('switch-off')){
    
    $(this).removeClass('switch-off');

    $(this).addClass('switch-on');

    $('#color-list').hide();
}
    else{

        $(this).removeClass('switch-on');

        $(this).addClass('switch-off');

       $('#color-list').show();
}
    event.preventDefault();
});
    
});