JSFiddle - React, Tailwind, and code Playground
HTML
<p>Click the switch</p>
<div class="switch-panel">
<div class="switch"></div>
</div>
CSS
.switch-panel {width: 40px; height: 200px; border: 1px solid #000; position: relative}
.switch {width: 40px; height: 40px; position: absolute; top: 100; left: 0; transition: top 1s; background-color: green}
.switch.active {top: 160px}
JavaScript
$('.switch').click(function(){
$(this).toggleClass('active');
});