32 Tailwind CSS Tabs
02 / 32
Pure TailwindMIT licensed

Neon Glow Tailwind Tabs with Per-Tab Accent Colors

Four electric tabs, each carrying its own accent in one custom property. Every label shares a single class list — text-(--c) border-(--c) bg-(--c)/12 — and only [--c:…] differs. The root re-points the same variable for the active tab, so the panel's glow and title follow the selection.

Live Demo
Plain CSSTailwind v4
Try it

Untitled UI Pro: 5,000+ React + Tailwind CSS v4 components · from $349 one-time

Untitled UI React · Affiliate link

Get Untitled UI Pro

The code

<section class="ttb-02 group/tabs grid min-h-svh w-full place-items-center bg-ttb02-bg bg-[radial-gradient(70%_50%_at_50%_0%,var(--color-ttb02-glow),transparent)] px-5 py-14 font-ttb02-mono text-ttb02-ink [--c:var(--color-ttb02-pink)] has-[#ttb02-r2:checked]:[--c:var(--color-ttb02-cyan)] has-[#ttb02-r3:checked]:[--c:var(--color-ttb02-lime)] has-[#ttb02-r4:checked]:[--c:var(--color-ttb02-amber)]" aria-label="Neon glow tabs demo">
  <div class="grid w-full max-w-xl justify-items-center gap-7">
    <div role="radiogroup" aria-label="Signal mode" class="grid w-full grid-cols-2 gap-2.5 sm:grid-cols-4">
      <label class="flex min-h-11 cursor-pointer items-center justify-center gap-2 rounded-lg border border-white/10 text-[11px] font-bold tracking-[0.16em] text-ttb02-mut uppercase transition-[color,border-color,background-color,box-shadow] duration-300 [--c:var(--color-ttb02-pink)] hover:border-white/25 hover:text-ttb02-ink has-checked:border-(--c) has-checked:bg-(--c)/12 has-checked:text-(--c) has-checked:shadow-[0_0_16px_color-mix(in_oklab,var(--c)_55%,transparent),inset_0_0_10px_color-mix(in_oklab,var(--c)_25%,transparent)] has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-dashed has-focus-visible:outline-(--c) motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb02" id="ttb02-r1" checked>Pulse</label>
      <label class="flex min-h-11 cursor-pointer items-center justify-center gap-2 rounded-lg border border-white/10 text-[11px] font-bold tracking-[0.16em] text-ttb02-mut uppercase transition-[color,border-color,background-color,box-shadow] duration-300 [--c:var(--color-ttb02-cyan)] hover:border-white/25 hover:text-ttb02-ink has-checked:border-(--c) has-checked:bg-(--c)/12 has-checked:text-(--c) has-checked:shadow-[0_0_16px_color-mix(in_oklab,var(--c)_55%,transparent),inset_0_0_10px_color-mix(in_oklab,var(--c)_25%,transparent)] has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-dashed has-focus-visible:outline-(--c) motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb02" id="ttb02-r2">Wave</label>
      <label class="flex min-h-11 cursor-pointer items-center justify-center gap-2 rounded-lg border border-white/10 text-[11px] font-bold tracking-[0.16em] text-ttb02-mut uppercase transition-[color,border-color,background-color,box-shadow] duration-300 [--c:var(--color-ttb02-lime)] hover:border-white/25 hover:text-ttb02-ink has-checked:border-(--c) has-checked:bg-(--c)/12 has-checked:text-(--c) has-checked:shadow-[0_0_16px_color-mix(in_oklab,var(--c)_55%,transparent),inset_0_0_10px_color-mix(in_oklab,var(--c)_25%,transparent)] has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-dashed has-focus-visible:outline-(--c) motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb02" id="ttb02-r3">Surge</label>
      <label class="flex min-h-11 cursor-pointer items-center justify-center gap-2 rounded-lg border border-white/10 text-[11px] font-bold tracking-[0.16em] text-ttb02-mut uppercase transition-[color,border-color,background-color,box-shadow] duration-300 [--c:var(--color-ttb02-amber)] hover:border-white/25 hover:text-ttb02-ink has-checked:border-(--c) has-checked:bg-(--c)/12 has-checked:text-(--c) has-checked:shadow-[0_0_16px_color-mix(in_oklab,var(--c)_55%,transparent),inset_0_0_10px_color-mix(in_oklab,var(--c)_25%,transparent)] has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-dashed has-focus-visible:outline-(--c) motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb02" id="ttb02-r4">Bloom</label>
    </div>
    <div class="w-full rounded-xl border border-(--c)/35 bg-white/[0.03] p-5 shadow-[0_0_40px_-12px_color-mix(in_oklab,var(--c)_45%,transparent)] transition-[border-color,box-shadow] duration-500 motion-reduce:transition-none">
      <p class="flex items-center gap-2 text-[11px] font-bold tracking-[0.2em] text-(--c) uppercase"><span aria-hidden="true" class="size-1.5 rounded-full bg-(--c) shadow-[0_0_8px_var(--c)]"></span>Live signal</p>
      <p class="mt-3 hidden font-ttb02-sans text-[15px] leading-relaxed text-ttb02-soft transition-opacity duration-300 group-has-[#ttb02-r1:checked]/tabs:block starting:opacity-0">Pulse — short, rhythmic bursts of light at a steady 120 BPM.</p>
      <p class="mt-3 hidden font-ttb02-sans text-[15px] leading-relaxed text-ttb02-soft transition-opacity duration-300 group-has-[#ttb02-r2:checked]/tabs:block starting:opacity-0">Wave — a continuous oscillation that rises and falls across the strip.</p>
      <p class="mt-3 hidden font-ttb02-sans text-[15px] leading-relaxed text-ttb02-soft transition-opacity duration-300 group-has-[#ttb02-r3:checked]/tabs:block starting:opacity-0">Surge — a sudden upward swell of power, then a slow release.</p>
      <p class="mt-3 hidden font-ttb02-sans text-[15px] leading-relaxed text-ttb02-soft transition-opacity duration-300 group-has-[#ttb02-r4:checked]/tabs:block starting:opacity-0">Bloom — a soft glow front that expands outward from the centre.</p>
    </div>
    <p aria-hidden="true" class="rounded-full border border-white/10 px-3.5 py-2 text-[11.5px] text-ttb02-mut">[--c:…] · has-checked:bg-(--c)/12 · root re-points --c</p>
  </div>
</section>
@import "tailwindcss";

@theme {
  --color-ttb02-bg: #0b0b12;
  --color-ttb02-bg: oklch(0.153 0.015 284.5);
  --color-ttb02-glow: #1d1636;
  --color-ttb02-glow: oklch(0.228 0.060 290.9);
  --color-ttb02-ink: #f2f1f7;
  --color-ttb02-ink: oklch(0.961 0.008 293.9);
  --color-ttb02-soft: #c9c7d6;
  --color-ttb02-soft: oklch(0.836 0.021 292.1);
  --color-ttb02-mut: #9a98ad;
  --color-ttb02-mut: oklch(0.688 0.031 289.9);
  --color-ttb02-pink: #ff4df2;
  --color-ttb02-pink: oklch(0.727 0.271 331.1);
  --color-ttb02-cyan: #3df0ff;
  --color-ttb02-cyan: oklch(0.875 0.138 203.6);
  --color-ttb02-lime: #c6ff3d;
  --color-ttb02-lime: oklch(0.928 0.216 125.2);
  --color-ttb02-amber: #ff9a3d;
  --color-ttb02-amber: oklch(0.776 0.159 59.0);
  --font-ttb02-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-ttb02-sans: 'Geist', system-ui, sans-serif;
}
/* 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. */

.ttb-02 {
  width: 100%;
  min-height: 100svh;
}

Setup — do this once per project

Skip this if your project already runs Tailwind v4.

1Load Tailwind
<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.

2Add the stylesheetRequiredthe @theme block is what makes the custom utilities exist
@import "tailwindcss";

@theme {
  --color-ttb02-bg: #0b0b12;
  --color-ttb02-bg: oklch(0.153 0.015 284.5);
  --color-ttb02-glow: #1d1636;
  --color-ttb02-glow: oklch(0.228 0.060 290.9);
  --color-ttb02-ink: #f2f1f7;
  --color-ttb02-ink: oklch(0.961 0.008 293.9);
  --color-ttb02-soft: #c9c7d6;
  --color-ttb02-soft: oklch(0.836 0.021 292.1);
  --color-ttb02-mut: #9a98ad;
  --color-ttb02-mut: oklch(0.688 0.031 289.9);
  --color-ttb02-pink: #ff4df2;
  --color-ttb02-pink: oklch(0.727 0.271 331.1);
  --color-ttb02-cyan: #3df0ff;
  --color-ttb02-cyan: oklch(0.875 0.138 203.6);
  --color-ttb02-lime: #c6ff3d;
  --color-ttb02-lime: oklch(0.928 0.216 125.2);
  --color-ttb02-amber: #ff9a3d;
  --color-ttb02-amber: oklch(0.776 0.159 59.0);
  --font-ttb02-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-ttb02-sans: 'Geist', system-ui, sans-serif;
}
/* 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. */

.ttb-02 {
  width: 100%;
  min-height: 100svh;
}
3Fonts used by this demooptional — skip if you have your own type stack
<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=JetBrains+Mono:wght@400;500;600;700;800&family=Geist:wght@400..800&display=swap">

What changed in the port

Which parts became utilities, which stayed CSS, and why.

  • color-mix(in srgb, var(--c) 12%, transparent) became has-checked:bg-(--c)/12 — v4's variable shorthand accepts the opacity modifier.
  • The inline style="--c:…" attributes became [--c:var(--color-ttb02-*)] arbitrary properties, so the colours are tokens, not literals in markup.
  • UI upgrade from the CSS original: the panel became a "live signal" card whose border, glow, dot and heading follow the active tab — the root re-points --c from the checked radio.
  • UI upgrade: resting labels moved from 45% white (≈3.2:1) to a solid 6.9:1 muted token; the row wraps to a 2×2 grid on phones instead of crushing four labels.
Paste this into ChatGPT, Claude, Cursor, or any coding assistant. The block below is pre-framed with everything the AI needs to integrate this demo into your project — markup, styles, scoping notes, and the source URL. Hit Copy and paste straight into your chat.
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: Neon Glow Tailwind Tabs with Per-Tab Accent Colors
Source: https://codefronts.com/navigation/tailwind-css-tabs/neon-glow-tailwind-tabs-per-tab-accent-colors/

Four electric tabs, each carrying its own accent in one custom property. Every label shares a single class list — text-(--c) border-(--c) bg-(--c)/12 — and only [--c:…] differs. The root re-points the same variable for the active tab, so the panel's glow and title follow the selection.
## HTML
```html
<section class="ttb-02 group/tabs grid min-h-svh w-full place-items-center bg-ttb02-bg bg-[radial-gradient(70%_50%_at_50%_0%,var(--color-ttb02-glow),transparent)] px-5 py-14 font-ttb02-mono text-ttb02-ink [--c:var(--color-ttb02-pink)] has-[#ttb02-r2:checked]:[--c:var(--color-ttb02-cyan)] has-[#ttb02-r3:checked]:[--c:var(--color-ttb02-lime)] has-[#ttb02-r4:checked]:[--c:var(--color-ttb02-amber)]" aria-label="Neon glow tabs demo">
  <div class="grid w-full max-w-xl justify-items-center gap-7">
    <div role="radiogroup" aria-label="Signal mode" class="grid w-full grid-cols-2 gap-2.5 sm:grid-cols-4">
      <label class="flex min-h-11 cursor-pointer items-center justify-center gap-2 rounded-lg border border-white/10 text-[11px] font-bold tracking-[0.16em] text-ttb02-mut uppercase transition-[color,border-color,background-color,box-shadow] duration-300 [--c:var(--color-ttb02-pink)] hover:border-white/25 hover:text-ttb02-ink has-checked:border-(--c) has-checked:bg-(--c)/12 has-checked:text-(--c) has-checked:shadow-[0_0_16px_color-mix(in_oklab,var(--c)_55%,transparent),inset_0_0_10px_color-mix(in_oklab,var(--c)_25%,transparent)] has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-dashed has-focus-visible:outline-(--c) motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb02" id="ttb02-r1" checked>Pulse</label>
      <label class="flex min-h-11 cursor-pointer items-center justify-center gap-2 rounded-lg border border-white/10 text-[11px] font-bold tracking-[0.16em] text-ttb02-mut uppercase transition-[color,border-color,background-color,box-shadow] duration-300 [--c:var(--color-ttb02-cyan)] hover:border-white/25 hover:text-ttb02-ink has-checked:border-(--c) has-checked:bg-(--c)/12 has-checked:text-(--c) has-checked:shadow-[0_0_16px_color-mix(in_oklab,var(--c)_55%,transparent),inset_0_0_10px_color-mix(in_oklab,var(--c)_25%,transparent)] has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-dashed has-focus-visible:outline-(--c) motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb02" id="ttb02-r2">Wave</label>
      <label class="flex min-h-11 cursor-pointer items-center justify-center gap-2 rounded-lg border border-white/10 text-[11px] font-bold tracking-[0.16em] text-ttb02-mut uppercase transition-[color,border-color,background-color,box-shadow] duration-300 [--c:var(--color-ttb02-lime)] hover:border-white/25 hover:text-ttb02-ink has-checked:border-(--c) has-checked:bg-(--c)/12 has-checked:text-(--c) has-checked:shadow-[0_0_16px_color-mix(in_oklab,var(--c)_55%,transparent),inset_0_0_10px_color-mix(in_oklab,var(--c)_25%,transparent)] has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-dashed has-focus-visible:outline-(--c) motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb02" id="ttb02-r3">Surge</label>
      <label class="flex min-h-11 cursor-pointer items-center justify-center gap-2 rounded-lg border border-white/10 text-[11px] font-bold tracking-[0.16em] text-ttb02-mut uppercase transition-[color,border-color,background-color,box-shadow] duration-300 [--c:var(--color-ttb02-amber)] hover:border-white/25 hover:text-ttb02-ink has-checked:border-(--c) has-checked:bg-(--c)/12 has-checked:text-(--c) has-checked:shadow-[0_0_16px_color-mix(in_oklab,var(--c)_55%,transparent),inset_0_0_10px_color-mix(in_oklab,var(--c)_25%,transparent)] has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-dashed has-focus-visible:outline-(--c) motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb02" id="ttb02-r4">Bloom</label>
    </div>
    <div class="w-full rounded-xl border border-(--c)/35 bg-white/[0.03] p-5 shadow-[0_0_40px_-12px_color-mix(in_oklab,var(--c)_45%,transparent)] transition-[border-color,box-shadow] duration-500 motion-reduce:transition-none">
      <p class="flex items-center gap-2 text-[11px] font-bold tracking-[0.2em] text-(--c) uppercase"><span aria-hidden="true" class="size-1.5 rounded-full bg-(--c) shadow-[0_0_8px_var(--c)]"></span>Live signal</p>
      <p class="mt-3 hidden font-ttb02-sans text-[15px] leading-relaxed text-ttb02-soft transition-opacity duration-300 group-has-[#ttb02-r1:checked]/tabs:block starting:opacity-0">Pulse — short, rhythmic bursts of light at a steady 120 BPM.</p>
      <p class="mt-3 hidden font-ttb02-sans text-[15px] leading-relaxed text-ttb02-soft transition-opacity duration-300 group-has-[#ttb02-r2:checked]/tabs:block starting:opacity-0">Wave — a continuous oscillation that rises and falls across the strip.</p>
      <p class="mt-3 hidden font-ttb02-sans text-[15px] leading-relaxed text-ttb02-soft transition-opacity duration-300 group-has-[#ttb02-r3:checked]/tabs:block starting:opacity-0">Surge — a sudden upward swell of power, then a slow release.</p>
      <p class="mt-3 hidden font-ttb02-sans text-[15px] leading-relaxed text-ttb02-soft transition-opacity duration-300 group-has-[#ttb02-r4:checked]/tabs:block starting:opacity-0">Bloom — a soft glow front that expands outward from the centre.</p>
    </div>
    <p aria-hidden="true" class="rounded-full border border-white/10 px-3.5 py-2 text-[11.5px] text-ttb02-mut">[--c:…] · has-checked:bg-(--c)/12 · root re-points --c</p>
  </div>
</section>
```
## CSS
```css
@import "tailwindcss";

@theme {
  --color-ttb02-bg: #0b0b12;
  --color-ttb02-bg: oklch(0.153 0.015 284.5);
  --color-ttb02-glow: #1d1636;
  --color-ttb02-glow: oklch(0.228 0.060 290.9);
  --color-ttb02-ink: #f2f1f7;
  --color-ttb02-ink: oklch(0.961 0.008 293.9);
  --color-ttb02-soft: #c9c7d6;
  --color-ttb02-soft: oklch(0.836 0.021 292.1);
  --color-ttb02-mut: #9a98ad;
  --color-ttb02-mut: oklch(0.688 0.031 289.9);
  --color-ttb02-pink: #ff4df2;
  --color-ttb02-pink: oklch(0.727 0.271 331.1);
  --color-ttb02-cyan: #3df0ff;
  --color-ttb02-cyan: oklch(0.875 0.138 203.6);
  --color-ttb02-lime: #c6ff3d;
  --color-ttb02-lime: oklch(0.928 0.216 125.2);
  --color-ttb02-amber: #ff9a3d;
  --color-ttb02-amber: oklch(0.776 0.159 59.0);
  --font-ttb02-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-ttb02-sans: 'Geist', system-ui, sans-serif;
}
/* 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. */

.ttb-02 {
  width: 100%;
  min-height: 100svh;
}
```

How this works

One class list, four tabs. The CSS original piped an inline style="--c:…" through color-mix(). In v4 the variable shorthand does that directly:

<label class="[--c:var(--color-ttb02-cyan)] border-white/10 text-ttb02-mut
  has-checked:border-(--c) has-checked:text-(--c) has-checked:bg-(--c)/12
  has-checked:shadow-[0_0_16px_color-mix(in_oklab,var(--c)_55%,transparent)]">

The panel listens too. The root sets --c from whichever radio is checked, so the panel border, status dot and heading glow in the active tab's colour without a second set of classes.

Each label's own [--c:…] wins over the inherited one, so the tabs never take on the selection's colour.

Make it yours

  • Recolour: edit the four --color-ttb02-* tokens; any hue works because the glow, wash and border all derive from --c.
  • Calmer glow: drop the shadow mix from 55% to 30% and remove the inset layer.
  • Light mode: paper stage, darker accents (L ≈ 0.55) and a 25% glow so it doesn't bloom on white.

Gotchas — read before shipping

  • bg-(--c)/12 falls back to the solid colour where color-mix() is missing — Tailwind emits that fallback first, so nothing breaks, it's just louder.
  • Neon text on near-black passes contrast easily; the resting labels are the risk, so they use a solid muted token instead of 45% white.
  • The glow transitions over 300ms; it stops under motion-reduce:.

Browser support

ChromeSafariFirefoxEdge
111+16.4+128+111+

color-mix() (the /12 modifier on a variable) is inside Tailwind v4's floor.

Techniques used in this demo

Utilitiesfirst-class utility or variant

Theme tokensset in @theme, used by a utility

Search CodeFronts

Loading…