16 / 29
All 29 in 29 Tailwind CSS Checkboxes
- 01Tailwind CSS Toggle Switch — iOS-Style SaaS Settings
- 02Tailwind Filter Chip Checkbox — Style Checkbox as Button
- 03Tailwind Pricing Plan Card Select — Checkbox-Style Selectable Cards
- 04Pure Tailwind CSS Accordion with Checkbox — No JavaScript
- 05Tailwind Indeterminate Checkbox — Select All with Tri-State
- 06Accessible Custom Checkbox in Tailwind CSS — WCAG Focus Ring
- 07Tailwind Slide Toggle with ON/OFF Labels — GPU translate3d
- 08Neon Glow Checkbox in Tailwind CSS — Dark Mode Gaming UI
- 09Animated SVG Checkmark in Tailwind CSS — stroke-dashoffset Draw
- 10Bouncy Checkbox Animation in Tailwind CSS — Spring cubic-bezier
- 11Glassmorphism Checkbox in Tailwind CSS — backdrop-blur Frosted Glass
- 12Neumorphism Checkbox in Tailwind CSS — Soft UI
- 13Liquid Fill Checkbox Animation in Tailwind CSS — Water Wave
- 14Rotating Ring Checkbox in Tailwind CSS — Spin-to-Check
- 15Brutalist Checkbox in Tailwind CSS — Neo-Brutalism Hard Shadow
- 16Animated Gradient Checkbox in Tailwind CSS — Rainbow Sweep
- 173D Flip Checkbox in Tailwind CSS — perspective & backface-hidden
- 18Material Ripple Checkbox in Tailwind CSS — State Layer & Wave
- 19Retro Pixel Art Checkbox in Tailwind CSS — 8-Bit Arcade Menu
- 20Tailwind CSS To-Do List Checkbox with Animated Strikethrough
- 21Gooey Blob Checkbox in Tailwind CSS — blur + contrast Filter
- 22Tailwind Dark Mode Toggle Switch — Sun & Moon, No JavaScript
- 23Pulse Ring Checkbox in Tailwind CSS — Live Status Indicator
- 24Tailwind CSS Dash-to-Check SVG Morph Checkbox
- 25Tri-State Checkbox in Tailwind CSS + JavaScript — Done / N/A / Unset
- 26Magnetic Hover Checkbox in Tailwind CSS + JavaScript
- 27Confetti Checkbox Animation in Tailwind CSS — Pure CSS Particle Burst
- 28Slide-In Label Checkbox in Tailwind CSS — Saved Tag Reveal
- 29Aurora Gradient Toggle Switch in Tailwind CSS — Premium Dark UI
Animated Gradient Checkbox in Tailwind CSS — Rainbow Sweep
Checked boxes fill with a rainbow that sweeps endlessly: a 300%-wide gradient on before:, scrolled by animate-tcb16-sweep. New: the checked label picks up the same gradient as text via bg-clip-text, tying label and box together.
Untitled UI Pro: 5,000+ React + Tailwind CSS v4 components · from $349 one-time
Untitled UI React · Affiliate link
The code
<section class="tcb-16 w-full min-h-svh grid place-items-center bg-tcb16-bg px-5 py-14 font-tcb16-sans text-tcb16-ink selection:bg-tcb16-violet selection:text-white" aria-label="Gradient sweep checkboxes">
<div class="w-full max-w-[25rem] rounded-2xl border border-tcb16-line bg-tcb16-panel px-4 py-3">
<label class="group flex min-h-13 cursor-pointer items-center gap-3.5 px-1.5"><input type="checkbox" class="peer sr-only" checked><span aria-hidden="true" class="relative grid size-[26px] flex-none place-items-center overflow-hidden rounded-lg border-2 border-tcb16-box bg-tcb16-well text-white transition-colors duration-250 peer-checked:border-transparent peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-tcb16-violet before:absolute before:inset-0 before:bg-[linear-gradient(115deg,#ff2e97,#ff9a3d,#ffe74c,#2effc8,#5b8bff,#c04cff,#ff2e97)] before:[background-size:300%_300%] before:opacity-0 before:transition-opacity before:duration-300 before:content-[''] group-has-checked:before:animate-tcb16-sweep group-has-checked:before:opacity-100 motion-reduce:before:animate-none"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" class="relative size-[15px] scale-50 opacity-0 drop-shadow-[0_1px_1px_rgb(0_0_0/0.35)] transition duration-200 ease-[cubic-bezier(.2,.9,.3,1.3)] group-has-checked:scale-100 group-has-checked:opacity-100"><path d="M20 6 9 17l-5-5"/></svg></span><span class="bg-[linear-gradient(90deg,#ff7ab8,#ffc36b,#7dffd9,#9db8ff)] bg-clip-text text-[15px] font-medium transition-colors group-has-checked:text-transparent">Mint on completion</span></label>
<label class="group flex min-h-13 cursor-pointer items-center gap-3.5 px-1.5"><input type="checkbox" class="peer sr-only"><span aria-hidden="true" class="relative grid size-[26px] flex-none place-items-center overflow-hidden rounded-lg border-2 border-tcb16-box bg-tcb16-well text-white transition-colors duration-250 peer-checked:border-transparent peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-tcb16-violet before:absolute before:inset-0 before:bg-[linear-gradient(115deg,#ff2e97,#ff9a3d,#ffe74c,#2effc8,#5b8bff,#c04cff,#ff2e97)] before:[background-size:300%_300%] before:opacity-0 before:transition-opacity before:duration-300 before:content-[''] group-has-checked:before:animate-tcb16-sweep group-has-checked:before:opacity-100 motion-reduce:before:animate-none"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" class="relative size-[15px] scale-50 opacity-0 drop-shadow-[0_1px_1px_rgb(0_0_0/0.35)] transition duration-200 ease-[cubic-bezier(.2,.9,.3,1.3)] group-has-checked:scale-100 group-has-checked:opacity-100"><path d="M20 6 9 17l-5-5"/></svg></span><span class="bg-[linear-gradient(90deg,#ff7ab8,#ffc36b,#7dffd9,#9db8ff)] bg-clip-text text-[15px] font-medium transition-colors group-has-checked:text-transparent">Enable gasless mode</span></label>
<label class="group flex min-h-13 cursor-pointer items-center gap-3.5 px-1.5"><input type="checkbox" class="peer sr-only" checked><span aria-hidden="true" class="relative grid size-[26px] flex-none place-items-center overflow-hidden rounded-lg border-2 border-tcb16-box bg-tcb16-well text-white transition-colors duration-250 peer-checked:border-transparent peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-tcb16-violet before:absolute before:inset-0 before:bg-[linear-gradient(115deg,#ff2e97,#ff9a3d,#ffe74c,#2effc8,#5b8bff,#c04cff,#ff2e97)] before:[background-size:300%_300%] before:opacity-0 before:transition-opacity before:duration-300 before:content-[''] group-has-checked:before:animate-tcb16-sweep group-has-checked:before:opacity-100 motion-reduce:before:animate-none"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" class="relative size-[15px] scale-50 opacity-0 drop-shadow-[0_1px_1px_rgb(0_0_0/0.35)] transition duration-200 ease-[cubic-bezier(.2,.9,.3,1.3)] group-has-checked:scale-100 group-has-checked:opacity-100"><path d="M20 6 9 17l-5-5"/></svg></span><span class="bg-[linear-gradient(90deg,#ff7ab8,#ffc36b,#7dffd9,#9db8ff)] bg-clip-text text-[15px] font-medium transition-colors group-has-checked:text-transparent">Show floor price</span></label>
</div>
</section><section class="tcb-16 w-full min-h-svh grid place-items-center bg-tcb16-bg px-5 py-14 font-tcb16-sans text-tcb16-ink selection:bg-tcb16-violet selection:text-white" aria-label="Gradient sweep checkboxes">
<div class="w-full max-w-[25rem] rounded-2xl border border-tcb16-line bg-tcb16-panel px-4 py-3">
<label class="group flex min-h-13 cursor-pointer items-center gap-3.5 px-1.5"><input type="checkbox" class="peer sr-only" checked><span aria-hidden="true" class="relative grid size-[26px] flex-none place-items-center overflow-hidden rounded-lg border-2 border-tcb16-box bg-tcb16-well text-white transition-colors duration-250 peer-checked:border-transparent peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-tcb16-violet before:absolute before:inset-0 before:bg-[linear-gradient(115deg,#ff2e97,#ff9a3d,#ffe74c,#2effc8,#5b8bff,#c04cff,#ff2e97)] before:[background-size:300%_300%] before:opacity-0 before:transition-opacity before:duration-300 before:content-[''] group-has-checked:before:animate-tcb16-sweep group-has-checked:before:opacity-100 motion-reduce:before:animate-none"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" class="relative size-[15px] scale-50 opacity-0 drop-shadow-[0_1px_1px_rgb(0_0_0/0.35)] transition duration-200 ease-[cubic-bezier(.2,.9,.3,1.3)] group-has-checked:scale-100 group-has-checked:opacity-100"><path d="M20 6 9 17l-5-5"/></svg></span><span class="bg-[linear-gradient(90deg,#ff7ab8,#ffc36b,#7dffd9,#9db8ff)] bg-clip-text text-[15px] font-medium transition-colors group-has-checked:text-transparent">Mint on completion</span></label>
<label class="group flex min-h-13 cursor-pointer items-center gap-3.5 px-1.5"><input type="checkbox" class="peer sr-only"><span aria-hidden="true" class="relative grid size-[26px] flex-none place-items-center overflow-hidden rounded-lg border-2 border-tcb16-box bg-tcb16-well text-white transition-colors duration-250 peer-checked:border-transparent peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-tcb16-violet before:absolute before:inset-0 before:bg-[linear-gradient(115deg,#ff2e97,#ff9a3d,#ffe74c,#2effc8,#5b8bff,#c04cff,#ff2e97)] before:[background-size:300%_300%] before:opacity-0 before:transition-opacity before:duration-300 before:content-[''] group-has-checked:before:animate-tcb16-sweep group-has-checked:before:opacity-100 motion-reduce:before:animate-none"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" class="relative size-[15px] scale-50 opacity-0 drop-shadow-[0_1px_1px_rgb(0_0_0/0.35)] transition duration-200 ease-[cubic-bezier(.2,.9,.3,1.3)] group-has-checked:scale-100 group-has-checked:opacity-100"><path d="M20 6 9 17l-5-5"/></svg></span><span class="bg-[linear-gradient(90deg,#ff7ab8,#ffc36b,#7dffd9,#9db8ff)] bg-clip-text text-[15px] font-medium transition-colors group-has-checked:text-transparent">Enable gasless mode</span></label>
<label class="group flex min-h-13 cursor-pointer items-center gap-3.5 px-1.5"><input type="checkbox" class="peer sr-only" checked><span aria-hidden="true" class="relative grid size-[26px] flex-none place-items-center overflow-hidden rounded-lg border-2 border-tcb16-box bg-tcb16-well text-white transition-colors duration-250 peer-checked:border-transparent peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-tcb16-violet before:absolute before:inset-0 before:bg-[linear-gradient(115deg,#ff2e97,#ff9a3d,#ffe74c,#2effc8,#5b8bff,#c04cff,#ff2e97)] before:[background-size:300%_300%] before:opacity-0 before:transition-opacity before:duration-300 before:content-[''] group-has-checked:before:animate-tcb16-sweep group-has-checked:before:opacity-100 motion-reduce:before:animate-none"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" class="relative size-[15px] scale-50 opacity-0 drop-shadow-[0_1px_1px_rgb(0_0_0/0.35)] transition duration-200 ease-[cubic-bezier(.2,.9,.3,1.3)] group-has-checked:scale-100 group-has-checked:opacity-100"><path d="M20 6 9 17l-5-5"/></svg></span><span class="bg-[linear-gradient(90deg,#ff7ab8,#ffc36b,#7dffd9,#9db8ff)] bg-clip-text text-[15px] font-medium transition-colors group-has-checked:text-transparent">Show floor price</span></label>
</div>
</section>@import "tailwindcss";
@theme {
--color-tcb16-bg: #0f1020;
--color-tcb16-bg: oklch(0.17 0.03 280);
--color-tcb16-panel: #181a30;
--color-tcb16-panel: oklch(0.22 0.04 280);
--color-tcb16-well: #12142a;
--color-tcb16-well: oklch(0.19 0.04 280);
--color-tcb16-line: #2a2d4a;
--color-tcb16-line: oklch(0.3 0.05 280);
--color-tcb16-box: #4a4f80;
--color-tcb16-box: oklch(0.43 0.08 280);
--color-tcb16-ink: #c7cbe6;
--color-tcb16-ink: oklch(0.85 0.04 280);
--color-tcb16-violet: #c04cff;
--color-tcb16-violet: oklch(0.64 0.26 310);
--font-tcb16-sans: 'Space Grotesk', system-ui, sans-serif;
--animate-tcb16-sweep: tcb16-sweep 4s linear infinite;
@keyframes tcb16-sweep {
from {
background-position: 0% 50%;
}
to {
background-position: 300% 50%;
}
}
}
/* Root rule: the full-bleed contract, stated in CSS as well as in the markup's utilities, so the
stage is sized before the browser build compiles. */
.tcb-16 {
width: 100%;
min-height: 100svh;
}@import "tailwindcss";
@theme {
--color-tcb16-bg: #0f1020;
--color-tcb16-bg: oklch(0.17 0.03 280);
--color-tcb16-panel: #181a30;
--color-tcb16-panel: oklch(0.22 0.04 280);
--color-tcb16-well: #12142a;
--color-tcb16-well: oklch(0.19 0.04 280);
--color-tcb16-line: #2a2d4a;
--color-tcb16-line: oklch(0.3 0.05 280);
--color-tcb16-box: #4a4f80;
--color-tcb16-box: oklch(0.43 0.08 280);
--color-tcb16-ink: #c7cbe6;
--color-tcb16-ink: oklch(0.85 0.04 280);
--color-tcb16-violet: #c04cff;
--color-tcb16-violet: oklch(0.64 0.26 310);
--font-tcb16-sans: 'Space Grotesk', system-ui, sans-serif;
--animate-tcb16-sweep: tcb16-sweep 4s linear infinite;
@keyframes tcb16-sweep {
from {
background-position: 0% 50%;
}
to {
background-position: 300% 50%;
}
}
}
/* Root rule: the full-bleed contract, stated in CSS as well as in the markup's utilities, so the
stage is sized before the browser build compiles. */
.tcb-16 {
width: 100%;
min-height: 100svh;
}Setup — do this once per project
Skip this if your project already runs Tailwind v4.
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>Compiles in the browser — perfect for a CodePen or a quick test, not for production.
npm install tailwindcss @tailwindcss/vite
npm install tailwindcss @tailwindcss/vite// vite.config.js ("type": "module" in package.json)
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [tailwindcss()],
})// vite.config.js ("type": "module" in package.json)
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [tailwindcss()],
})Any v4 setup works — Vite, PostCSS or the CLI. Nothing in this demo is bundler-specific.
@import "tailwindcss";
@theme {
--color-tcb16-bg: #0f1020;
--color-tcb16-bg: oklch(0.17 0.03 280);
--color-tcb16-panel: #181a30;
--color-tcb16-panel: oklch(0.22 0.04 280);
--color-tcb16-well: #12142a;
--color-tcb16-well: oklch(0.19 0.04 280);
--color-tcb16-line: #2a2d4a;
--color-tcb16-line: oklch(0.3 0.05 280);
--color-tcb16-box: #4a4f80;
--color-tcb16-box: oklch(0.43 0.08 280);
--color-tcb16-ink: #c7cbe6;
--color-tcb16-ink: oklch(0.85 0.04 280);
--color-tcb16-violet: #c04cff;
--color-tcb16-violet: oklch(0.64 0.26 310);
--font-tcb16-sans: 'Space Grotesk', system-ui, sans-serif;
--animate-tcb16-sweep: tcb16-sweep 4s linear infinite;
@keyframes tcb16-sweep {
from {
background-position: 0% 50%;
}
to {
background-position: 300% 50%;
}
}
}
/* Root rule: the full-bleed contract, stated in CSS as well as in the markup's utilities, so the
stage is sized before the browser build compiles. */
.tcb-16 {
width: 100%;
min-height: 100svh;
}@import "tailwindcss";
@theme {
--color-tcb16-bg: #0f1020;
--color-tcb16-bg: oklch(0.17 0.03 280);
--color-tcb16-panel: #181a30;
--color-tcb16-panel: oklch(0.22 0.04 280);
--color-tcb16-well: #12142a;
--color-tcb16-well: oklch(0.19 0.04 280);
--color-tcb16-line: #2a2d4a;
--color-tcb16-line: oklch(0.3 0.05 280);
--color-tcb16-box: #4a4f80;
--color-tcb16-box: oklch(0.43 0.08 280);
--color-tcb16-ink: #c7cbe6;
--color-tcb16-ink: oklch(0.85 0.04 280);
--color-tcb16-violet: #c04cff;
--color-tcb16-violet: oklch(0.64 0.26 310);
--font-tcb16-sans: 'Space Grotesk', system-ui, sans-serif;
--animate-tcb16-sweep: tcb16-sweep 4s linear infinite;
@keyframes tcb16-sweep {
from {
background-position: 0% 50%;
}
to {
background-position: 300% 50%;
}
}
}
/* Root rule: the full-bleed contract, stated in CSS as well as in the markup's utilities, so the
stage is sized before the browser build compiles. */
.tcb-16 {
width: 100%;
min-height: 100svh;
}<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap">What changed in the port
Which parts became utilities, which stayed CSS, and why.
- The
::beforegradient and itsbackground-size:300% 300%became arbitrarybefore:utilities; the sweep keyframes moved into@theme. border-color:transparenton check becamepeer-checked:border-transparent.- UI upgrade from the CSS original: checked labels render in gradient text (
bg-clip-text), echoing the box, and the white tick gained a drop-shadow so it stays legible over the yellow stop. - UI upgrade: the empty-box border rose from
#3a3e66(1.6:1 on the panel) to 2.4:1 against the well and 3:1 against the panel.
Here's a working CSS demo from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Animated Gradient Checkbox in Tailwind CSS — Rainbow Sweep
Source: https://codefronts.com/components/tailwind-css-checkboxes/animated-gradient-checkbox-tailwind/
Checked boxes fill with a rainbow that sweeps endlessly: a 300%-wide gradient on before:, scrolled by animate-tcb16-sweep. New: the checked label picks up the same gradient as text via bg-clip-text, tying label and box together.
## HTML
```html
<section class="tcb-16 w-full min-h-svh grid place-items-center bg-tcb16-bg px-5 py-14 font-tcb16-sans text-tcb16-ink selection:bg-tcb16-violet selection:text-white" aria-label="Gradient sweep checkboxes">
<div class="w-full max-w-[25rem] rounded-2xl border border-tcb16-line bg-tcb16-panel px-4 py-3">
<label class="group flex min-h-13 cursor-pointer items-center gap-3.5 px-1.5"><input type="checkbox" class="peer sr-only" checked><span aria-hidden="true" class="relative grid size-[26px] flex-none place-items-center overflow-hidden rounded-lg border-2 border-tcb16-box bg-tcb16-well text-white transition-colors duration-250 peer-checked:border-transparent peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-tcb16-violet before:absolute before:inset-0 before:bg-[linear-gradient(115deg,#ff2e97,#ff9a3d,#ffe74c,#2effc8,#5b8bff,#c04cff,#ff2e97)] before:[background-size:300%_300%] before:opacity-0 before:transition-opacity before:duration-300 before:content-[''] group-has-checked:before:animate-tcb16-sweep group-has-checked:before:opacity-100 motion-reduce:before:animate-none"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" class="relative size-[15px] scale-50 opacity-0 drop-shadow-[0_1px_1px_rgb(0_0_0/0.35)] transition duration-200 ease-[cubic-bezier(.2,.9,.3,1.3)] group-has-checked:scale-100 group-has-checked:opacity-100"><path d="M20 6 9 17l-5-5"/></svg></span><span class="bg-[linear-gradient(90deg,#ff7ab8,#ffc36b,#7dffd9,#9db8ff)] bg-clip-text text-[15px] font-medium transition-colors group-has-checked:text-transparent">Mint on completion</span></label>
<label class="group flex min-h-13 cursor-pointer items-center gap-3.5 px-1.5"><input type="checkbox" class="peer sr-only"><span aria-hidden="true" class="relative grid size-[26px] flex-none place-items-center overflow-hidden rounded-lg border-2 border-tcb16-box bg-tcb16-well text-white transition-colors duration-250 peer-checked:border-transparent peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-tcb16-violet before:absolute before:inset-0 before:bg-[linear-gradient(115deg,#ff2e97,#ff9a3d,#ffe74c,#2effc8,#5b8bff,#c04cff,#ff2e97)] before:[background-size:300%_300%] before:opacity-0 before:transition-opacity before:duration-300 before:content-[''] group-has-checked:before:animate-tcb16-sweep group-has-checked:before:opacity-100 motion-reduce:before:animate-none"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" class="relative size-[15px] scale-50 opacity-0 drop-shadow-[0_1px_1px_rgb(0_0_0/0.35)] transition duration-200 ease-[cubic-bezier(.2,.9,.3,1.3)] group-has-checked:scale-100 group-has-checked:opacity-100"><path d="M20 6 9 17l-5-5"/></svg></span><span class="bg-[linear-gradient(90deg,#ff7ab8,#ffc36b,#7dffd9,#9db8ff)] bg-clip-text text-[15px] font-medium transition-colors group-has-checked:text-transparent">Enable gasless mode</span></label>
<label class="group flex min-h-13 cursor-pointer items-center gap-3.5 px-1.5"><input type="checkbox" class="peer sr-only" checked><span aria-hidden="true" class="relative grid size-[26px] flex-none place-items-center overflow-hidden rounded-lg border-2 border-tcb16-box bg-tcb16-well text-white transition-colors duration-250 peer-checked:border-transparent peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-tcb16-violet before:absolute before:inset-0 before:bg-[linear-gradient(115deg,#ff2e97,#ff9a3d,#ffe74c,#2effc8,#5b8bff,#c04cff,#ff2e97)] before:[background-size:300%_300%] before:opacity-0 before:transition-opacity before:duration-300 before:content-[''] group-has-checked:before:animate-tcb16-sweep group-has-checked:before:opacity-100 motion-reduce:before:animate-none"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" class="relative size-[15px] scale-50 opacity-0 drop-shadow-[0_1px_1px_rgb(0_0_0/0.35)] transition duration-200 ease-[cubic-bezier(.2,.9,.3,1.3)] group-has-checked:scale-100 group-has-checked:opacity-100"><path d="M20 6 9 17l-5-5"/></svg></span><span class="bg-[linear-gradient(90deg,#ff7ab8,#ffc36b,#7dffd9,#9db8ff)] bg-clip-text text-[15px] font-medium transition-colors group-has-checked:text-transparent">Show floor price</span></label>
</div>
</section>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-tcb16-bg: #0f1020;
--color-tcb16-bg: oklch(0.17 0.03 280);
--color-tcb16-panel: #181a30;
--color-tcb16-panel: oklch(0.22 0.04 280);
--color-tcb16-well: #12142a;
--color-tcb16-well: oklch(0.19 0.04 280);
--color-tcb16-line: #2a2d4a;
--color-tcb16-line: oklch(0.3 0.05 280);
--color-tcb16-box: #4a4f80;
--color-tcb16-box: oklch(0.43 0.08 280);
--color-tcb16-ink: #c7cbe6;
--color-tcb16-ink: oklch(0.85 0.04 280);
--color-tcb16-violet: #c04cff;
--color-tcb16-violet: oklch(0.64 0.26 310);
--font-tcb16-sans: 'Space Grotesk', system-ui, sans-serif;
--animate-tcb16-sweep: tcb16-sweep 4s linear infinite;
@keyframes tcb16-sweep {
from {
background-position: 0% 50%;
}
to {
background-position: 300% 50%;
}
}
}
/* Root rule: the full-bleed contract, stated in CSS as well as in the markup's utilities, so the
stage is sized before the browser build compiles. */
.tcb-16 {
width: 100%;
min-height: 100svh;
}
```Here's a working CSS demo from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Animated Gradient Checkbox in Tailwind CSS — Rainbow Sweep
Source: https://codefronts.com/components/tailwind-css-checkboxes/animated-gradient-checkbox-tailwind/
Checked boxes fill with a rainbow that sweeps endlessly: a 300%-wide gradient on before:, scrolled by animate-tcb16-sweep. New: the checked label picks up the same gradient as text via bg-clip-text, tying label and box together.
## HTML
```html
<section class="tcb-16 w-full min-h-svh grid place-items-center bg-tcb16-bg px-5 py-14 font-tcb16-sans text-tcb16-ink selection:bg-tcb16-violet selection:text-white" aria-label="Gradient sweep checkboxes">
<div class="w-full max-w-[25rem] rounded-2xl border border-tcb16-line bg-tcb16-panel px-4 py-3">
<label class="group flex min-h-13 cursor-pointer items-center gap-3.5 px-1.5"><input type="checkbox" class="peer sr-only" checked><span aria-hidden="true" class="relative grid size-[26px] flex-none place-items-center overflow-hidden rounded-lg border-2 border-tcb16-box bg-tcb16-well text-white transition-colors duration-250 peer-checked:border-transparent peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-tcb16-violet before:absolute before:inset-0 before:bg-[linear-gradient(115deg,#ff2e97,#ff9a3d,#ffe74c,#2effc8,#5b8bff,#c04cff,#ff2e97)] before:[background-size:300%_300%] before:opacity-0 before:transition-opacity before:duration-300 before:content-[''] group-has-checked:before:animate-tcb16-sweep group-has-checked:before:opacity-100 motion-reduce:before:animate-none"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" class="relative size-[15px] scale-50 opacity-0 drop-shadow-[0_1px_1px_rgb(0_0_0/0.35)] transition duration-200 ease-[cubic-bezier(.2,.9,.3,1.3)] group-has-checked:scale-100 group-has-checked:opacity-100"><path d="M20 6 9 17l-5-5"/></svg></span><span class="bg-[linear-gradient(90deg,#ff7ab8,#ffc36b,#7dffd9,#9db8ff)] bg-clip-text text-[15px] font-medium transition-colors group-has-checked:text-transparent">Mint on completion</span></label>
<label class="group flex min-h-13 cursor-pointer items-center gap-3.5 px-1.5"><input type="checkbox" class="peer sr-only"><span aria-hidden="true" class="relative grid size-[26px] flex-none place-items-center overflow-hidden rounded-lg border-2 border-tcb16-box bg-tcb16-well text-white transition-colors duration-250 peer-checked:border-transparent peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-tcb16-violet before:absolute before:inset-0 before:bg-[linear-gradient(115deg,#ff2e97,#ff9a3d,#ffe74c,#2effc8,#5b8bff,#c04cff,#ff2e97)] before:[background-size:300%_300%] before:opacity-0 before:transition-opacity before:duration-300 before:content-[''] group-has-checked:before:animate-tcb16-sweep group-has-checked:before:opacity-100 motion-reduce:before:animate-none"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" class="relative size-[15px] scale-50 opacity-0 drop-shadow-[0_1px_1px_rgb(0_0_0/0.35)] transition duration-200 ease-[cubic-bezier(.2,.9,.3,1.3)] group-has-checked:scale-100 group-has-checked:opacity-100"><path d="M20 6 9 17l-5-5"/></svg></span><span class="bg-[linear-gradient(90deg,#ff7ab8,#ffc36b,#7dffd9,#9db8ff)] bg-clip-text text-[15px] font-medium transition-colors group-has-checked:text-transparent">Enable gasless mode</span></label>
<label class="group flex min-h-13 cursor-pointer items-center gap-3.5 px-1.5"><input type="checkbox" class="peer sr-only" checked><span aria-hidden="true" class="relative grid size-[26px] flex-none place-items-center overflow-hidden rounded-lg border-2 border-tcb16-box bg-tcb16-well text-white transition-colors duration-250 peer-checked:border-transparent peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-tcb16-violet before:absolute before:inset-0 before:bg-[linear-gradient(115deg,#ff2e97,#ff9a3d,#ffe74c,#2effc8,#5b8bff,#c04cff,#ff2e97)] before:[background-size:300%_300%] before:opacity-0 before:transition-opacity before:duration-300 before:content-[''] group-has-checked:before:animate-tcb16-sweep group-has-checked:before:opacity-100 motion-reduce:before:animate-none"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" class="relative size-[15px] scale-50 opacity-0 drop-shadow-[0_1px_1px_rgb(0_0_0/0.35)] transition duration-200 ease-[cubic-bezier(.2,.9,.3,1.3)] group-has-checked:scale-100 group-has-checked:opacity-100"><path d="M20 6 9 17l-5-5"/></svg></span><span class="bg-[linear-gradient(90deg,#ff7ab8,#ffc36b,#7dffd9,#9db8ff)] bg-clip-text text-[15px] font-medium transition-colors group-has-checked:text-transparent">Show floor price</span></label>
</div>
</section>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-tcb16-bg: #0f1020;
--color-tcb16-bg: oklch(0.17 0.03 280);
--color-tcb16-panel: #181a30;
--color-tcb16-panel: oklch(0.22 0.04 280);
--color-tcb16-well: #12142a;
--color-tcb16-well: oklch(0.19 0.04 280);
--color-tcb16-line: #2a2d4a;
--color-tcb16-line: oklch(0.3 0.05 280);
--color-tcb16-box: #4a4f80;
--color-tcb16-box: oklch(0.43 0.08 280);
--color-tcb16-ink: #c7cbe6;
--color-tcb16-ink: oklch(0.85 0.04 280);
--color-tcb16-violet: #c04cff;
--color-tcb16-violet: oklch(0.64 0.26 310);
--font-tcb16-sans: 'Space Grotesk', system-ui, sans-serif;
--animate-tcb16-sweep: tcb16-sweep 4s linear infinite;
@keyframes tcb16-sweep {
from {
background-position: 0% 50%;
}
to {
background-position: 300% 50%;
}
}
}
/* Root rule: the full-bleed contract, stated in CSS as well as in the markup's utilities, so the
stage is sized before the browser build compiles. */
.tcb-16 {
width: 100%;
min-height: 100svh;
}
```How this works
Oversized, then scrolled. The gradient is three times the box's width; animating background-position by exactly 300% returns to an identical frame, so the loop is seamless.
Gradient text. The label always carries the gradient as its background; only when checked does bg-clip-text text-transparent reveal it through the glyphs.
Make it yours
- Palette: edit the seven stops in the arbitrary gradient (keep first = last).
- Slower sweep:
8sin the animation token. - Static gradient: drop the animation for a calmer look.
- Gradient border: move the gradient to the box and put a dark inner box inside.
Gotchas — read before shipping
- Background-position animation repaints the pseudo-element each frame — fine on small boxes.
- Gradient text needs a solid fallback colour for forced-colors mode;
forced-colors:text-[CanvasText]. - Commas inside arbitrary gradients are fine; spaces must be underscores.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 111+ | 16.4+ | 128+ | 111+ |
background-clip:text is unprefixed in Chrome 120; Tailwind emits the prefix.