JSFiddle - React, Tailwind, and code Playground
HTML
<button type="button" class="btn" id="btn1">Details</button>
CSS
.btn {
background: #3498db;
border-radius: 0px;
font-family: Arial;
color: #ffffff;
font-size: 12px;
padding: 2px 2px 2px 2px;
text-decoration: none;
height: 30px;
width: 70px;
margin-top: 5px;
margin-bottom: 5px;
display: block;
}
.btn:active {
background: #cecece;
text-decoration: none;
}
JavaScript
$('.btn').click(function(){
if($(this).hasClass('active')){
$(this).removeClass('active')
} else {
$(this).addClass('active')
}
});