HTML
<fieldset class="crb-pill">
<legend class="crb-sr">Billing</legend>
<input type="radio" name="crb-pill" id="crb-pill-1" checked />
<label for="crb-pill-1">Monthly</label>
<input type="radio" name="crb-pill" id="crb-pill-2" />
<label for="crb-pill-2">Yearly</label>
<input type="radio" name="crb-pill" id="crb-pill-3" />
<label for="crb-pill-3">Forever</label>
<span class="crb-pill-thumb"></span>
</fieldset>
CSS
.crb-pill {
display: inline-flex; position: relative; padding: 4px;
background: #1a1a28; border: 1px solid rgba(255,255,255,0.08);
border-radius: 999px;
}
.crb-pill input { appearance: none; -webkit-appearance: none; position: absolute; opacity: 0; }
.crb-pill label {
flex: 1 1 0; min-width: 80px;
position: relative; z-index: 1;
padding: 8px 16px;
font: 600 12px/1 system-ui, sans-serif; color: #b8b6d4;
text-align: center;
cursor: pointer; transition: color 0.25s;
border-radius: 999px;
}
.crb-pill input:checked + label { color: #fff; }
.crb-pill-thumb {
position: absolute; top: 4px; bottom: 4px; left: 4px;
width: calc(33.333% - 2.667px);
background: linear-gradient(135deg, #7c6cff, #a78bfa);
border-radius: 999px; z-index: 0;
transition: transform 0.4s cubic-bezier(0.65,0,0.35,1);
}
#crb-pill-2:checked ~ .crb-pill-thumb { transform: translateX(100%); }
#crb-pill-3:checked ~ .crb-pill-thumb { transform: translateX(200%); }
.crb-sr {
position: absolute !important;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}