The lightest option: real browser radios recolored with accent-color and enlarged with width and height. A springy scale on hover and press, and the chosen label turns bold.
Also known as: css radio button color, change radio button size css, accent-color radio button.
<div class="rad-native-accent-color" role="radiogroup" aria-label="Delivery window"> <label><input type="radio" name="rad-native-accent-color" value="morning" checked><span>Morning</span></label> <label><input type="radio" name="rad-native-accent-color" value="afternoon"><span>Afternoon</span></label> <label><input type="radio" name="rad-native-accent-color" value="evening"><span>Evening</span></label> </div>
.rad-native-accent-color {
--c: var(--rad-color, #3b82f6);
font-size: var(--rad-size, 18px);
display: grid;
gap: 0.6em;
font-family: system-ui, sans-serif;
line-height: 1.2;
}
.rad-native-accent-color label {
display: flex;
align-items: center;
gap: 0.6em;
cursor: pointer;
}
.rad-native-accent-color input {
width: 1.3em;
height: 1.3em;
margin: 0;
accent-color: var(--c);
cursor: pointer;
transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rad-native-accent-color label:hover input {
transform: scale(1.12);
}
.rad-native-accent-color input:active {
transform: scale(0.9);
}
.rad-native-accent-color span {
transition: color 0.2s ease;
}
.rad-native-accent-color input:checked + span {
color: var(--c);
font-weight: 600;
}
.rad-native-accent-color input:focus-visible {
outline: 0.12em solid var(--c);
outline-offset: 0.15em;
}
@media (prefers-reduced-motion: reduce) {
.rad-native-accent-color, .rad-native-accent-color *, .rad-native-accent-color::before, .rad-native-accent-color::after, .rad-native-accent-color *::before, .rad-native-accent-color *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}The same effect using Tailwind utility classes. No custom CSS or config needed.
<div role="radiogroup" aria-label="Delivery window" class="grid gap-2">
<label class="group flex cursor-pointer items-center gap-2">
<input type="radio" name="window" value="morning" checked class="peer h-5 w-5 cursor-pointer accent-blue-500 transition-transform duration-200 ease-[cubic-bezier(.34,1.56,.64,1)] group-hover:scale-110 active:scale-90 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500">
<span class="transition-colors peer-checked:font-semibold peer-checked:text-blue-500">Morning</span>
</label>
<label class="group flex cursor-pointer items-center gap-2">
<input type="radio" name="window" value="afternoon" class="peer h-5 w-5 cursor-pointer accent-blue-500 transition-transform duration-200 ease-[cubic-bezier(.34,1.56,.64,1)] group-hover:scale-110 active:scale-90 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500">
<span class="transition-colors peer-checked:font-semibold peer-checked:text-blue-500">Afternoon</span>
</label>
<label class="group flex cursor-pointer items-center gap-2">
<input type="radio" name="window" value="evening" class="peer h-5 w-5 cursor-pointer accent-blue-500 transition-transform duration-200 ease-[cubic-bezier(.34,1.56,.64,1)] group-hover:scale-110 active:scale-90 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500">
<span class="transition-colors peer-checked:font-semibold peer-checked:text-blue-500">Evening</span>
</label>
</div>--rad-color on the element or a parent.
Currently previewing #3b82f6.--rad-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 18px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.