JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<body>
<div class="rb-container">
<input type="radio" name="rb" value="Leftest" id="rb-leftest">
<label for="rb-leftest">Leftest</label>
<input type="radio" name="rb" value="Left" id="rb-left">
<label for="rb-left">Left</label>
<input type="radio" name="rb" value="Middle" id="rb-middle">
<label for="rb-middle">Middle</label>
<input type="radio" name="rb" value="Right" id="rb-right">
<label for="rb-right">Right</label>
<input type="radio" name="rb" value="Rightest" id="rb-rightest">
<label for="rb-rightest">Rightest</label>
</div>
</body>
CSS
.rb-container {
border: 1px solid lightgrey;
border-radius: 5px;
margin: 0;
padding: 0;
font-size: 0;
float: left;
}
.rb-container label {
display: inline-block;
padding: 10px;
border-right: 1px solid lightgrey;
font-size: 16px;
width: 50px;
text-align: center;
transition: 0.1s;
}
.rb-container label:last-child {
border: none;
}
.rb-container input[type="radio"] {
position: absolute;
top: -1000px;
}
.rb-container label:hover {
background-color: lightgrey;
cursor: pointer;
}
.rb-container label:active {
box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.25);
}
.rb-container input:checked + label {
background-color: lightgreen;
box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.25);
}