JSFiddle - React, Tailwind, and code Playground

HTML

<div class="input-block">
<label for="newsletter" class="switch-label">Send newsletter</label>
<input type="checkbox" name="newsletter" id="newsletter" checked="checked" />
</div>

CSS

body{
    padding: 50px;
    font-family: Arial;
    font-size: 100%;
}

.switch-label{
    line-height: 26px;
    display: block;
    float: left;
    margin-right: 10px;
}
.input-block{
    margin-bottom: 1em;
}

/* Rich checkbox */

.rich-checkbox{
    position: relative;
    cursor: pointer;
    display: inline-block;
    background: #DDD;
    color: #3f3f3f;
    width: 70px;
    
    text-shadow: 0px 1px 0px #f2f2f2;
    filter: dropshadow(color=#f2f2f2, offx=0, offy=1);
      
    -webkit-border-radius: 15px;
    -moz-border-radius: 15px;
    border-radius: 15px;
    height: 26px;
    line-height: 26px;
    
    -webkit-box-shadow: inset 0px 1px 2px 0px rgba(0, 0, 0, 0.2);
    box-shadow: inset 0px 1px 2px 0px rgba(0, 0, 0, 0.2);
}
.rich-checkbox.on{
    background: #C4E69F;
    color: #3c5226;
}
.rich-checkbox .handler{
    display: block;
    background: #CCC;
    width: 28px;
    height: 28px;
    position: absolute;
    margin-top: -1px;
    -webkit-border-radius: 15px;
    -moz-border-radius: 15px;
    border-radius: 15px;
    -webkit-box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.3);
    box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.3); 

-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;   

background: rgb(255,255,255);
background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(235,235,235,1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(235,235,235,1)));
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(235,235,235,1) 100%);
background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(235,235,235,1) 100%);
background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(235,235,235,1) 100%);
background: linear-gradient(top, rgba(255,255,255,1) 0%,rgba(235,235,235,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(...

JavaScript

;
(function($) {
    $.checkbox = function(el, options) {
        var base = this;

        base.$el = $(el);
        base.el = el;

        base.$el.data("checkbox", base);

        base.init = function() {
            base.options = $.extend({}, $.checkbox.defaultOptions, options);
        };

        // Run initializer
        base.init();
    };

    $.checkbox.defaultOptions = {
        onchange: function(state) {}
    };

    $.fn.checkbox = function(options) {
        return this.each(function() {
            var base = (new $.checkbox(this, options));
            var $check = $(this);
            $check.hide();

            var $richCheck = $('<div class="rich-checkbox"></div>');
            var $handler = $('<div class="handler"></div>');
            var $onState = $('<div class="on-state">On</div>');
            var $offState = $('<div class="off-state">Off</div>');

            if ($check.attr('checked') == 'checked') {
                $richCheck.addClass('on');
            } else {
                $richCheck.addClass('off');
            }

            $richCheck.append($handler);
            $richCheck.append($onState);
            $richCheck.append($offState);

            $onState.click(function() {
                var $parentNode = $(this).parent();
                $parentNode.removeClass("on");
                $parentNode.addClass("off");
                $check.removeAttr('checked');
                base.options.onchange(false);
            });
            $offState.click(function() {
                var $parentNode = $(this).parent();
                $parentNode.removeClass("off");
                $parentNode.addClass("on");
                $check.attr('checked', 'checked');
                base.options.onchange(true);
            });
            $handler.click(function() {
                var $parentNode = $(this).parent();
                if ($parentNode.hasClass('on')) {
                    $parentNode.removeClass("on");
                   ...