JSFiddle - React, Tailwind, and code Playground

HTML

<section id="stage">
            
           
            <div class="slider-frame">
                <span class="slider-button">NO</span>
            </div>
            <input type="hidden" id="slider" value="false">

        </section>

CSS

#stage .slider-frame {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  margin: 0 auto;
  width: 60px;
  height: 20px;
  background-color: #ff0000;
  background-repeat: no-repeat;
  background-image: -webkit-gradient(linear, left top, left bottom, from(#ff0000), to(#404040));
  background-image: -webkit-linear-gradient(#2b2b2b, #404040);
  background-image: -moz-linear-gradient(#2b2b2b, #404040);
  background-image: -o-linear-gradient(top, #2b2b2b, #404040);
  background-image: -khtml-gradient(linear, left top, left bottom, from(#2b2b2b), to(#404040));
  filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#2b2b2b', EndColorStr='#404040', GradientType=0);
  -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#2b2b2b', EndColorStr='#404040', GradientType=0))";
  border-top: 1px solid #333333;
  border-right: 1px solid #333333;
  border-bottom: 1px solid #666666;
  border-left: 1px solid #333333;
  -moz-border-radius: 5px;
  border-radius: 5px;
  -webkit-box-shadow: inset 0px 1px 8px 0 rgba(0, 0, 0, 0.25);
  -moz-box-shadow: inset 0px 1px 8px 0 rgba(0, 0, 0, 0.25);
  box-shadow: inset 0px 1px 8px 0 rgba(0, 0, 0, 0.25);
}
#stage .slider-frame .slider-button {
  display: block;
  margin: 0;
  padding: 0;
  width: 25px;
  height: 17px;
  line-height: 17px;
  background: #ff0000;
  -moz-border-radius: 5px;
  border-radius: 5px;
  border: 1px solid #70430e;
  -webkit-transition: all 0.25s ease-in-out;
  -moz-transition: all 0.25s ease-in-out;
  transition: all 0.25s ease-in-out;
  color: #fff;
  font-family:Helvetica;
  font-size:11px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  text-align: center;
  cursor: pointer;
}
#stage .slider-frame .slider-button.on {
  margin-left: 30px;
  background: #ff0000;
  border: 1px solid #0f3f74;
}
#stage .slider-frame .slider-button:before {
  position: absolute;
  display: block;
  margin: 0;
  padding: 0;
  width: 25px;
  height: 12px;
  background:...

JavaScript

$('.slider-button').toggle(function(){
        $(this).addClass('on').html('YES');
        $('#slider').val(true);
    },function(){
        $(this).removeClass('on').html('NO');
        $('#slider').val(false);
    });