JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<body>
<div class="rb-container">
<input type="radio" name="rb" value="Left"><label>Left</label>
<input type="radio" name="rb" value="Middle"><label>Middle</label>
<input type="radio" name="rb" value="Right"> <label>Right</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);
}