04 / 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
Pure Tailwind CSS Accordion with Checkbox — No JavaScript
A smooth-height FAQ accordion with zero script: each panel animates grid-rows-[0fr] → peer-checked:grid-rows-[1fr], the only reliable way to transition to auto height. The chevron chip flips and fills from group-has-checked:.
Untitled UI Pro: 5,000+ React + Tailwind CSS v4 components · from $349 one-time
Untitled UI React · Affiliate link
The code
<section class="tcb-04 w-full min-h-svh grid place-items-center bg-tcb04-bg px-5 py-14 font-tcb04-sans text-tcb04-ink selection:bg-tcb04-acc selection:text-white" aria-label="Frequently asked questions">
<div class="w-full max-w-[35rem]">
<h2 class="mb-5 text-[26px] font-bold tracking-[-0.02em]">Questions, answered</h2>
<div class="divide-y divide-tcb04-line overflow-hidden rounded-2xl border border-tcb04-line bg-white shadow-tcb04-panel">
<div class="group">
<input type="checkbox" class="peer sr-only" id="tcb04-1" checked>
<label for="tcb04-1" class="flex min-h-15 cursor-pointer items-center justify-between gap-4 px-5.5 py-4 text-[15px] font-semibold transition-colors hover:bg-tcb04-hover peer-focus-visible:outline-3 peer-focus-visible:-outline-offset-3 peer-focus-visible:outline-tcb04-acc">What browsers are supported?
<span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-full bg-tcb04-chip text-tcb04-mut transition-colors duration-300 group-has-checked:bg-tcb04-acc group-has-checked:text-white"><span class="size-2.5 -translate-y-0.5 rotate-45 border-r-[2.5px] border-b-[2.5px] border-current transition-transform duration-300 group-has-checked:translate-y-0.5 group-has-checked:rotate-[-135deg] motion-reduce:transition-none"></span></span>
</label>
<div class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-350 ease-out peer-checked:grid-rows-[1fr] motion-reduce:transition-none">
<div class="min-h-0 overflow-hidden"><p class="px-5.5 pb-5 text-[14px] leading-relaxed text-tcb04-mut">Every evergreen browser — Chrome, Edge, Safari and Firefox. The grid-row reveal degrades to an instant open in legacy engines.</p></div>
</div>
</div>
<div class="group">
<input type="checkbox" class="peer sr-only" id="tcb04-2">
<label for="tcb04-2" class="flex min-h-15 cursor-pointer items-center justify-between gap-4 px-5.5 py-4 text-[15px] font-semibold transition-colors hover:bg-tcb04-hover peer-focus-visible:outline-3 peer-focus-visible:-outline-offset-3 peer-focus-visible:outline-tcb04-acc">Is there any JavaScript?
<span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-full bg-tcb04-chip text-tcb04-mut transition-colors duration-300 group-has-checked:bg-tcb04-acc group-has-checked:text-white"><span class="size-2.5 -translate-y-0.5 rotate-45 border-r-[2.5px] border-b-[2.5px] border-current transition-transform duration-300 group-has-checked:translate-y-0.5 group-has-checked:rotate-[-135deg] motion-reduce:transition-none"></span></span>
</label>
<div class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-350 ease-out peer-checked:grid-rows-[1fr] motion-reduce:transition-none">
<div class="min-h-0 overflow-hidden"><p class="px-5.5 pb-5 text-[14px] leading-relaxed text-tcb04-mut">None. The open/close state is the checkbox itself, and the height animation is pure CSS via grid-template-rows.</p></div>
</div>
</div>
<div class="group">
<input type="checkbox" class="peer sr-only" id="tcb04-3">
<label for="tcb04-3" class="flex min-h-15 cursor-pointer items-center justify-between gap-4 px-5.5 py-4 text-[15px] font-semibold transition-colors hover:bg-tcb04-hover peer-focus-visible:outline-3 peer-focus-visible:-outline-offset-3 peer-focus-visible:outline-tcb04-acc">Can multiple panels stay open?
<span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-full bg-tcb04-chip text-tcb04-mut transition-colors duration-300 group-has-checked:bg-tcb04-acc group-has-checked:text-white"><span class="size-2.5 -translate-y-0.5 rotate-45 border-r-[2.5px] border-b-[2.5px] border-current transition-transform duration-300 group-has-checked:translate-y-0.5 group-has-checked:rotate-[-135deg] motion-reduce:transition-none"></span></span>
</label>
<div class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-350 ease-out peer-checked:grid-rows-[1fr] motion-reduce:transition-none">
<div class="min-h-0 overflow-hidden"><p class="px-5.5 pb-5 text-[14px] leading-relaxed text-tcb04-mut">Yes — these are independent checkboxes. Swap them for radios with a shared name to force a single-open accordion.</p></div>
</div>
</div>
</div>
</div>
</section><section class="tcb-04 w-full min-h-svh grid place-items-center bg-tcb04-bg px-5 py-14 font-tcb04-sans text-tcb04-ink selection:bg-tcb04-acc selection:text-white" aria-label="Frequently asked questions">
<div class="w-full max-w-[35rem]">
<h2 class="mb-5 text-[26px] font-bold tracking-[-0.02em]">Questions, answered</h2>
<div class="divide-y divide-tcb04-line overflow-hidden rounded-2xl border border-tcb04-line bg-white shadow-tcb04-panel">
<div class="group">
<input type="checkbox" class="peer sr-only" id="tcb04-1" checked>
<label for="tcb04-1" class="flex min-h-15 cursor-pointer items-center justify-between gap-4 px-5.5 py-4 text-[15px] font-semibold transition-colors hover:bg-tcb04-hover peer-focus-visible:outline-3 peer-focus-visible:-outline-offset-3 peer-focus-visible:outline-tcb04-acc">What browsers are supported?
<span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-full bg-tcb04-chip text-tcb04-mut transition-colors duration-300 group-has-checked:bg-tcb04-acc group-has-checked:text-white"><span class="size-2.5 -translate-y-0.5 rotate-45 border-r-[2.5px] border-b-[2.5px] border-current transition-transform duration-300 group-has-checked:translate-y-0.5 group-has-checked:rotate-[-135deg] motion-reduce:transition-none"></span></span>
</label>
<div class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-350 ease-out peer-checked:grid-rows-[1fr] motion-reduce:transition-none">
<div class="min-h-0 overflow-hidden"><p class="px-5.5 pb-5 text-[14px] leading-relaxed text-tcb04-mut">Every evergreen browser — Chrome, Edge, Safari and Firefox. The grid-row reveal degrades to an instant open in legacy engines.</p></div>
</div>
</div>
<div class="group">
<input type="checkbox" class="peer sr-only" id="tcb04-2">
<label for="tcb04-2" class="flex min-h-15 cursor-pointer items-center justify-between gap-4 px-5.5 py-4 text-[15px] font-semibold transition-colors hover:bg-tcb04-hover peer-focus-visible:outline-3 peer-focus-visible:-outline-offset-3 peer-focus-visible:outline-tcb04-acc">Is there any JavaScript?
<span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-full bg-tcb04-chip text-tcb04-mut transition-colors duration-300 group-has-checked:bg-tcb04-acc group-has-checked:text-white"><span class="size-2.5 -translate-y-0.5 rotate-45 border-r-[2.5px] border-b-[2.5px] border-current transition-transform duration-300 group-has-checked:translate-y-0.5 group-has-checked:rotate-[-135deg] motion-reduce:transition-none"></span></span>
</label>
<div class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-350 ease-out peer-checked:grid-rows-[1fr] motion-reduce:transition-none">
<div class="min-h-0 overflow-hidden"><p class="px-5.5 pb-5 text-[14px] leading-relaxed text-tcb04-mut">None. The open/close state is the checkbox itself, and the height animation is pure CSS via grid-template-rows.</p></div>
</div>
</div>
<div class="group">
<input type="checkbox" class="peer sr-only" id="tcb04-3">
<label for="tcb04-3" class="flex min-h-15 cursor-pointer items-center justify-between gap-4 px-5.5 py-4 text-[15px] font-semibold transition-colors hover:bg-tcb04-hover peer-focus-visible:outline-3 peer-focus-visible:-outline-offset-3 peer-focus-visible:outline-tcb04-acc">Can multiple panels stay open?
<span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-full bg-tcb04-chip text-tcb04-mut transition-colors duration-300 group-has-checked:bg-tcb04-acc group-has-checked:text-white"><span class="size-2.5 -translate-y-0.5 rotate-45 border-r-[2.5px] border-b-[2.5px] border-current transition-transform duration-300 group-has-checked:translate-y-0.5 group-has-checked:rotate-[-135deg] motion-reduce:transition-none"></span></span>
</label>
<div class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-350 ease-out peer-checked:grid-rows-[1fr] motion-reduce:transition-none">
<div class="min-h-0 overflow-hidden"><p class="px-5.5 pb-5 text-[14px] leading-relaxed text-tcb04-mut">Yes — these are independent checkboxes. Swap them for radios with a shared name to force a single-open accordion.</p></div>
</div>
</div>
</div>
</div>
</section>@import "tailwindcss";
@theme {
--color-tcb04-bg: #f4f5f7;
--color-tcb04-bg: oklch(0.97 0.004 260);
--color-tcb04-ink: #1f2430;
--color-tcb04-ink: oklch(0.25 0.02 265);
--color-tcb04-mut: #555c69;
--color-tcb04-mut: oklch(0.46 0.02 265);
--color-tcb04-line: #eceef2;
--color-tcb04-line: oklch(0.945 0.006 265);
--color-tcb04-hover: #f8f9fb;
--color-tcb04-hover: oklch(0.982 0.003 265);
--color-tcb04-chip: #f0f2f5;
--color-tcb04-chip: oklch(0.96 0.005 265);
--color-tcb04-acc: #2f7de1;
--color-tcb04-acc: oklch(0.6 0.17 255);
--font-tcb04-sans: 'DM Sans', system-ui, sans-serif;
--shadow-tcb04-panel: 0 18px 40px -30px rgb(16 24 40 / 0.5);
}
/* 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-04 {
width: 100%;
min-height: 100svh;
}@import "tailwindcss";
@theme {
--color-tcb04-bg: #f4f5f7;
--color-tcb04-bg: oklch(0.97 0.004 260);
--color-tcb04-ink: #1f2430;
--color-tcb04-ink: oklch(0.25 0.02 265);
--color-tcb04-mut: #555c69;
--color-tcb04-mut: oklch(0.46 0.02 265);
--color-tcb04-line: #eceef2;
--color-tcb04-line: oklch(0.945 0.006 265);
--color-tcb04-hover: #f8f9fb;
--color-tcb04-hover: oklch(0.982 0.003 265);
--color-tcb04-chip: #f0f2f5;
--color-tcb04-chip: oklch(0.96 0.005 265);
--color-tcb04-acc: #2f7de1;
--color-tcb04-acc: oklch(0.6 0.17 255);
--font-tcb04-sans: 'DM Sans', system-ui, sans-serif;
--shadow-tcb04-panel: 0 18px 40px -30px rgb(16 24 40 / 0.5);
}
/* 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-04 {
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-tcb04-bg: #f4f5f7;
--color-tcb04-bg: oklch(0.97 0.004 260);
--color-tcb04-ink: #1f2430;
--color-tcb04-ink: oklch(0.25 0.02 265);
--color-tcb04-mut: #555c69;
--color-tcb04-mut: oklch(0.46 0.02 265);
--color-tcb04-line: #eceef2;
--color-tcb04-line: oklch(0.945 0.006 265);
--color-tcb04-hover: #f8f9fb;
--color-tcb04-hover: oklch(0.982 0.003 265);
--color-tcb04-chip: #f0f2f5;
--color-tcb04-chip: oklch(0.96 0.005 265);
--color-tcb04-acc: #2f7de1;
--color-tcb04-acc: oklch(0.6 0.17 255);
--font-tcb04-sans: 'DM Sans', system-ui, sans-serif;
--shadow-tcb04-panel: 0 18px 40px -30px rgb(16 24 40 / 0.5);
}
/* 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-04 {
width: 100%;
min-height: 100svh;
}@import "tailwindcss";
@theme {
--color-tcb04-bg: #f4f5f7;
--color-tcb04-bg: oklch(0.97 0.004 260);
--color-tcb04-ink: #1f2430;
--color-tcb04-ink: oklch(0.25 0.02 265);
--color-tcb04-mut: #555c69;
--color-tcb04-mut: oklch(0.46 0.02 265);
--color-tcb04-line: #eceef2;
--color-tcb04-line: oklch(0.945 0.006 265);
--color-tcb04-hover: #f8f9fb;
--color-tcb04-hover: oklch(0.982 0.003 265);
--color-tcb04-chip: #f0f2f5;
--color-tcb04-chip: oklch(0.96 0.005 265);
--color-tcb04-acc: #2f7de1;
--color-tcb04-acc: oklch(0.6 0.17 255);
--font-tcb04-sans: 'DM Sans', system-ui, sans-serif;
--shadow-tcb04-panel: 0 18px 40px -30px rgb(16 24 40 / 0.5);
}
/* 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-04 {
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=DM+Sans:opsz,wght@9..40,400..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=DM+Sans:opsz,wght@9..40,400..700&display=swap">What changed in the port
Which parts became utilities, which stayed CSS, and why.
input:checked ~ .panel{grid-template-rows:1fr}becamepeer-checked:grid-rows-[1fr]; the chevron's descendant rule becamegroup-has-checked:.- The separate
padding-bottomtoggle was removed — padding now sits inside the clipped child, so height and spacing animate as one. - UI upgrade from the CSS original: the chevron lives in a 32px chip that fills with the accent when open, rows tint on hover, and the list has a heading.
- UI upgrade: answer copy rose from
#6b7280(4.8:1) tooklch(0.46)(7:1), and the inner div gained the missingmin-h-0that Safari needs to fully collapse.
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: Pure Tailwind CSS Accordion with Checkbox — No JavaScript
Source: https://codefronts.com/components/tailwind-css-checkboxes/pure-tailwind-accordion-checkbox-no-javascript/
A smooth-height FAQ accordion with zero script: each panel animates grid-rows-[0fr] → peer-checked:grid-rows-[1fr], the only reliable way to transition to auto height. The chevron chip flips and fills from group-has-checked:.
## HTML
```html
<section class="tcb-04 w-full min-h-svh grid place-items-center bg-tcb04-bg px-5 py-14 font-tcb04-sans text-tcb04-ink selection:bg-tcb04-acc selection:text-white" aria-label="Frequently asked questions">
<div class="w-full max-w-[35rem]">
<h2 class="mb-5 text-[26px] font-bold tracking-[-0.02em]">Questions, answered</h2>
<div class="divide-y divide-tcb04-line overflow-hidden rounded-2xl border border-tcb04-line bg-white shadow-tcb04-panel">
<div class="group">
<input type="checkbox" class="peer sr-only" id="tcb04-1" checked>
<label for="tcb04-1" class="flex min-h-15 cursor-pointer items-center justify-between gap-4 px-5.5 py-4 text-[15px] font-semibold transition-colors hover:bg-tcb04-hover peer-focus-visible:outline-3 peer-focus-visible:-outline-offset-3 peer-focus-visible:outline-tcb04-acc">What browsers are supported?
<span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-full bg-tcb04-chip text-tcb04-mut transition-colors duration-300 group-has-checked:bg-tcb04-acc group-has-checked:text-white"><span class="size-2.5 -translate-y-0.5 rotate-45 border-r-[2.5px] border-b-[2.5px] border-current transition-transform duration-300 group-has-checked:translate-y-0.5 group-has-checked:rotate-[-135deg] motion-reduce:transition-none"></span></span>
</label>
<div class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-350 ease-out peer-checked:grid-rows-[1fr] motion-reduce:transition-none">
<div class="min-h-0 overflow-hidden"><p class="px-5.5 pb-5 text-[14px] leading-relaxed text-tcb04-mut">Every evergreen browser — Chrome, Edge, Safari and Firefox. The grid-row reveal degrades to an instant open in legacy engines.</p></div>
</div>
</div>
<div class="group">
<input type="checkbox" class="peer sr-only" id="tcb04-2">
<label for="tcb04-2" class="flex min-h-15 cursor-pointer items-center justify-between gap-4 px-5.5 py-4 text-[15px] font-semibold transition-colors hover:bg-tcb04-hover peer-focus-visible:outline-3 peer-focus-visible:-outline-offset-3 peer-focus-visible:outline-tcb04-acc">Is there any JavaScript?
<span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-full bg-tcb04-chip text-tcb04-mut transition-colors duration-300 group-has-checked:bg-tcb04-acc group-has-checked:text-white"><span class="size-2.5 -translate-y-0.5 rotate-45 border-r-[2.5px] border-b-[2.5px] border-current transition-transform duration-300 group-has-checked:translate-y-0.5 group-has-checked:rotate-[-135deg] motion-reduce:transition-none"></span></span>
</label>
<div class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-350 ease-out peer-checked:grid-rows-[1fr] motion-reduce:transition-none">
<div class="min-h-0 overflow-hidden"><p class="px-5.5 pb-5 text-[14px] leading-relaxed text-tcb04-mut">None. The open/close state is the checkbox itself, and the height animation is pure CSS via grid-template-rows.</p></div>
</div>
</div>
<div class="group">
<input type="checkbox" class="peer sr-only" id="tcb04-3">
<label for="tcb04-3" class="flex min-h-15 cursor-pointer items-center justify-between gap-4 px-5.5 py-4 text-[15px] font-semibold transition-colors hover:bg-tcb04-hover peer-focus-visible:outline-3 peer-focus-visible:-outline-offset-3 peer-focus-visible:outline-tcb04-acc">Can multiple panels stay open?
<span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-full bg-tcb04-chip text-tcb04-mut transition-colors duration-300 group-has-checked:bg-tcb04-acc group-has-checked:text-white"><span class="size-2.5 -translate-y-0.5 rotate-45 border-r-[2.5px] border-b-[2.5px] border-current transition-transform duration-300 group-has-checked:translate-y-0.5 group-has-checked:rotate-[-135deg] motion-reduce:transition-none"></span></span>
</label>
<div class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-350 ease-out peer-checked:grid-rows-[1fr] motion-reduce:transition-none">
<div class="min-h-0 overflow-hidden"><p class="px-5.5 pb-5 text-[14px] leading-relaxed text-tcb04-mut">Yes — these are independent checkboxes. Swap them for radios with a shared name to force a single-open accordion.</p></div>
</div>
</div>
</div>
</div>
</section>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-tcb04-bg: #f4f5f7;
--color-tcb04-bg: oklch(0.97 0.004 260);
--color-tcb04-ink: #1f2430;
--color-tcb04-ink: oklch(0.25 0.02 265);
--color-tcb04-mut: #555c69;
--color-tcb04-mut: oklch(0.46 0.02 265);
--color-tcb04-line: #eceef2;
--color-tcb04-line: oklch(0.945 0.006 265);
--color-tcb04-hover: #f8f9fb;
--color-tcb04-hover: oklch(0.982 0.003 265);
--color-tcb04-chip: #f0f2f5;
--color-tcb04-chip: oklch(0.96 0.005 265);
--color-tcb04-acc: #2f7de1;
--color-tcb04-acc: oklch(0.6 0.17 255);
--font-tcb04-sans: 'DM Sans', system-ui, sans-serif;
--shadow-tcb04-panel: 0 18px 40px -30px rgb(16 24 40 / 0.5);
}
/* 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-04 {
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: Pure Tailwind CSS Accordion with Checkbox — No JavaScript
Source: https://codefronts.com/components/tailwind-css-checkboxes/pure-tailwind-accordion-checkbox-no-javascript/
A smooth-height FAQ accordion with zero script: each panel animates grid-rows-[0fr] → peer-checked:grid-rows-[1fr], the only reliable way to transition to auto height. The chevron chip flips and fills from group-has-checked:.
## HTML
```html
<section class="tcb-04 w-full min-h-svh grid place-items-center bg-tcb04-bg px-5 py-14 font-tcb04-sans text-tcb04-ink selection:bg-tcb04-acc selection:text-white" aria-label="Frequently asked questions">
<div class="w-full max-w-[35rem]">
<h2 class="mb-5 text-[26px] font-bold tracking-[-0.02em]">Questions, answered</h2>
<div class="divide-y divide-tcb04-line overflow-hidden rounded-2xl border border-tcb04-line bg-white shadow-tcb04-panel">
<div class="group">
<input type="checkbox" class="peer sr-only" id="tcb04-1" checked>
<label for="tcb04-1" class="flex min-h-15 cursor-pointer items-center justify-between gap-4 px-5.5 py-4 text-[15px] font-semibold transition-colors hover:bg-tcb04-hover peer-focus-visible:outline-3 peer-focus-visible:-outline-offset-3 peer-focus-visible:outline-tcb04-acc">What browsers are supported?
<span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-full bg-tcb04-chip text-tcb04-mut transition-colors duration-300 group-has-checked:bg-tcb04-acc group-has-checked:text-white"><span class="size-2.5 -translate-y-0.5 rotate-45 border-r-[2.5px] border-b-[2.5px] border-current transition-transform duration-300 group-has-checked:translate-y-0.5 group-has-checked:rotate-[-135deg] motion-reduce:transition-none"></span></span>
</label>
<div class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-350 ease-out peer-checked:grid-rows-[1fr] motion-reduce:transition-none">
<div class="min-h-0 overflow-hidden"><p class="px-5.5 pb-5 text-[14px] leading-relaxed text-tcb04-mut">Every evergreen browser — Chrome, Edge, Safari and Firefox. The grid-row reveal degrades to an instant open in legacy engines.</p></div>
</div>
</div>
<div class="group">
<input type="checkbox" class="peer sr-only" id="tcb04-2">
<label for="tcb04-2" class="flex min-h-15 cursor-pointer items-center justify-between gap-4 px-5.5 py-4 text-[15px] font-semibold transition-colors hover:bg-tcb04-hover peer-focus-visible:outline-3 peer-focus-visible:-outline-offset-3 peer-focus-visible:outline-tcb04-acc">Is there any JavaScript?
<span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-full bg-tcb04-chip text-tcb04-mut transition-colors duration-300 group-has-checked:bg-tcb04-acc group-has-checked:text-white"><span class="size-2.5 -translate-y-0.5 rotate-45 border-r-[2.5px] border-b-[2.5px] border-current transition-transform duration-300 group-has-checked:translate-y-0.5 group-has-checked:rotate-[-135deg] motion-reduce:transition-none"></span></span>
</label>
<div class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-350 ease-out peer-checked:grid-rows-[1fr] motion-reduce:transition-none">
<div class="min-h-0 overflow-hidden"><p class="px-5.5 pb-5 text-[14px] leading-relaxed text-tcb04-mut">None. The open/close state is the checkbox itself, and the height animation is pure CSS via grid-template-rows.</p></div>
</div>
</div>
<div class="group">
<input type="checkbox" class="peer sr-only" id="tcb04-3">
<label for="tcb04-3" class="flex min-h-15 cursor-pointer items-center justify-between gap-4 px-5.5 py-4 text-[15px] font-semibold transition-colors hover:bg-tcb04-hover peer-focus-visible:outline-3 peer-focus-visible:-outline-offset-3 peer-focus-visible:outline-tcb04-acc">Can multiple panels stay open?
<span aria-hidden="true" class="grid size-8 flex-none place-items-center rounded-full bg-tcb04-chip text-tcb04-mut transition-colors duration-300 group-has-checked:bg-tcb04-acc group-has-checked:text-white"><span class="size-2.5 -translate-y-0.5 rotate-45 border-r-[2.5px] border-b-[2.5px] border-current transition-transform duration-300 group-has-checked:translate-y-0.5 group-has-checked:rotate-[-135deg] motion-reduce:transition-none"></span></span>
</label>
<div class="grid grid-rows-[0fr] transition-[grid-template-rows] duration-350 ease-out peer-checked:grid-rows-[1fr] motion-reduce:transition-none">
<div class="min-h-0 overflow-hidden"><p class="px-5.5 pb-5 text-[14px] leading-relaxed text-tcb04-mut">Yes — these are independent checkboxes. Swap them for radios with a shared name to force a single-open accordion.</p></div>
</div>
</div>
</div>
</div>
</section>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-tcb04-bg: #f4f5f7;
--color-tcb04-bg: oklch(0.97 0.004 260);
--color-tcb04-ink: #1f2430;
--color-tcb04-ink: oklch(0.25 0.02 265);
--color-tcb04-mut: #555c69;
--color-tcb04-mut: oklch(0.46 0.02 265);
--color-tcb04-line: #eceef2;
--color-tcb04-line: oklch(0.945 0.006 265);
--color-tcb04-hover: #f8f9fb;
--color-tcb04-hover: oklch(0.982 0.003 265);
--color-tcb04-chip: #f0f2f5;
--color-tcb04-chip: oklch(0.96 0.005 265);
--color-tcb04-acc: #2f7de1;
--color-tcb04-acc: oklch(0.6 0.17 255);
--font-tcb04-sans: 'DM Sans', system-ui, sans-serif;
--shadow-tcb04-panel: 0 18px 40px -30px rgb(16 24 40 / 0.5);
}
/* 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-04 {
width: 100%;
min-height: 100svh;
}
```How this works
Why grid rows. height: auto can't be transitioned, but a one-row grid can go from 0fr to 1fr. The panel's only child needs min-h-0 overflow-hidden or it refuses to shrink.
Padding lives inside the clip. The original animated padding-bottom separately; here the padding sits on an inner <p>, so one transition moves everything.
Independent panels. These are checkboxes, so several can stay open; give them radios with one name for single-open behaviour.
Make it yours
- Single-open:
type="radio" name="tcb04"on every input. - Speed:
duration-350on the panel; pair withease-[cubic-bezier(.3,.9,.3,1)]for a softer land. - Plus/minus icon: replace the chevron with two bars and
group-has-checked:rotate-90on one. - Semantic alternative: for FAQs that must be findable with Ctrl+F while closed, see the
<details>accordion in the blockquote set (demo 24).
Gotchas — read before shipping
- Closed panel text is still in the DOM and read by screen readers in browse mode; for strict hiding add
group-not-has-checked:invisiblewith a delay. - Ids must be unique per page — they're namespaced
tcb04-1…3. - The ring is inset (
-outline-offset-3) because the list clips its children withoverflow-hidden.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 111+ | 16.4+ | 128+ | 111+ |
Animated grid-template-rows lands in Chrome 107, Safari 16 and Firefox 66; older engines open instantly.