The one-line fix: accent-color paints the native checkbox in your brand color, em sizing makes it bigger, and a springy scale on hover and press adds feedback. No custom drawing at all.
Also known as: css checkbox color, change checkbox color css, accent-color checkbox.
<label class="chk-accent-color-checkbox"> <input type="checkbox"> Send me updates </label>
.chk-accent-color-checkbox {
--c: var(--chk-color, #3b82f6);
font-size: var(--chk-size, 24px);
position: relative;
display: inline-flex;
align-items: center;
gap: 0.6em;
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
line-height: 1.3;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.chk-accent-color-checkbox input {
flex: none;
width: 1.25em;
height: 1.25em;
margin: 0;
font-size: inherit;
accent-color: var(--c);
cursor: pointer;
transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chk-accent-color-checkbox:hover input {
transform: scale(1.12);
}
.chk-accent-color-checkbox input:active {
transform: scale(0.88);
transition-duration: 0.1s;
}
.chk-accent-color-checkbox input:focus-visible {
outline: 0.125em solid var(--c);
outline-offset: 0.18em;
}
@media (prefers-reduced-motion: reduce) {
.chk-accent-color-checkbox, .chk-accent-color-checkbox *, .chk-accent-color-checkbox::before, .chk-accent-color-checkbox::after, .chk-accent-color-checkbox *::before, .chk-accent-color-checkbox *::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.
<label class="group inline-flex cursor-pointer items-center gap-2.5"> <input type="checkbox" class="h-5 w-5 shrink-0 cursor-pointer accent-blue-500 transition-transform duration-300 ease-[cubic-bezier(.34,1.56,.64,1)] group-hover:scale-110 active:scale-90 active:duration-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500"> Send me updates </label>
--chk-color on the element or a parent.
Currently previewing #3b82f6.--chk-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 24px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.