JSFiddle - React, Tailwind, and code Playground
HTML
<button id="b1" class="bouton">Autre monde ...</button>
CSS
.bouton {
background-color: #FFFF00;
border-radius: 50px;
border-width: 20;
box-shadow:
rgba(25, 25, 25, 0.04) 0 0 1px 0,
rgba(0, 0, 0, 0.1) 0 3px 4px 0;
color:
#0099FF;
cursor: pointer;
display: inline-block;
font-family: Arial, sans-serif;
font-size: 15px;
height: 30px;
padding: 0 25px;
}
.variant {
background-color: #0099FF;
color: #FFFF00;
}
JavaScript
const b1 = document.getElementById("b1");
b1.addEventListener("click", changeColor);
function changeColor() {
b1.classList.toggle('variant')
};