JSFiddle - React, Tailwind, and code Playground
HTML
<div class="red-button">
<span class="bg-fix"></span>
<p>Progress Button</p>
</div>
<button class="click-me">Click Me</button>
CSS
.red-button {
display: block;
height: 40px;
width: 250px;
overflow: hidden;
position: relative;
background: red;
padding: 0;
}
span.bg-fix {
display: block;
height: 100%;
width: 0;
position: absolute;
z-index: 0
top: 0;
left: 0;
background: blue;
transition: width 10s ease-in-out;
}
p {
font-family: sans-serif;
white-space: no-warp;
line-height: 40px;
position: relative;
z-index: 1
width: 100%;
text-align: center;
color: #fff;
margin: 0;
padding: 0;
}
JavaScript
$("button.click-me").click(function () {
$('span.bg-fix').css("width", "100%");
});