JSFiddle - React, Tailwind, and code Playground
HTML
<div class="customCheckboxBtns">
<div class="ck-button">
<label>
<input checked="checked" name="column-2" type="checkbox">1</label>
</div>
<div class="ck-button">
<label class="selected">
<input checked="checked" name="column-3" type="checkbox">2</label>
</div>
<div class="ck-button">
<label>
<input checked="checked" name="column-4" type="checkbox">3</label>
</div>
<div class="ck-button">
<label>
<input checked="checked" name="column-5" type="checkbox">4</label>
</div>
<div class="ck-button">
<label>
<input checked="checked" name="column-6" type="checkbox">5</label>
</div>
</div>
CSS
.customCheckboxBtns {
margin-bottom: 1rem;
margin-top: 0.25rem;
overflow: auto;
}
.ck-button {
margin-right: 0.375rem;
background-color: #ffffff;
border-radius: 4px;
border: 1px solid #26a69a;
overflow: auto;
float: left;
font-family: 'Source Sans Pro', sans-serif;
transition: all 0.2s ease 0s;
color: #999999;
}
.ck-button:hover {
background: #7dcac2;
border: 1px solid #26a69a;
color: #26a69a;
background-color: #ffffff;
}
.ck-button label {
text-align: center;
padding: 0.25rem 0.5rem;
display: block;
background: #26a69a;
color: #ffffff;
transition: all 0.2s ease 0s;
}
.ck-button label:hover {
cursor: pointer;
}
.ck-button input:checked {
background: #26a69a none repeat scroll 0 0;
color: #ffffff;
padding: 0.25rem 0.5rem;
transition: all 0.2s ease 0s;
}
.ck-button label:hover {
background: #7dcac2 none repeat scroll 0 0;
color: #ffffff;
}
.ck-button label input {
position: absolute;
/*top:-2000px;*/
}
.ck-button label input[type="checkbox"] {
position: absolute;
visibility: hidden;
}
label.selected {
background: #7dcac2 none repeat scroll 0 0;
color: #ffffff;
}
JavaScript
$('.ck-button input').on('change', function() {
$(this.parentNode).toggleClass('selected', this.checked);
});