JSFiddle - React, Tailwind, and code Playground

HTML

<div class="container">
    <input type="radio" name="switcher" value="1" checked="checked" />
    <input type="radio" name="switcher" value="2"/>
    <input type="radio" name="switcher" value="3"/>
    <div class="switch"></div>
</div>

CSS

.container {
    background-color: #f00;
    width: 100px;
    height: 30px;
    position: relative;
}

.switch {
    width: 33%;
    height:100%;
    width: 33%;
    background-color: #ff0;
    position: absolute;
    top: 0;
    left: 0;
}

.container input {
    width: 33%;
    opacity: 0;
    height: 30px;
    cursor: pointer;
    margin: 0;
    padding: 0;
    display: block;
    float: left;
}

.container input:checked~.switch {
    left: 0;
}

.container input~input:checked~.switch {
    left: 33%;
}

.container input~input~input:checked~.switch {
    left: 66%;
}