08 / 25
All 25 in 25 Tailwind CSS Button Groups
- 01Tailwind Split Button with Anchor-Positioned Popover Dropdown (No JS)
- 02Tailwind Segmented Control with Motion-Path Comet Indicator
- 03Tailwind Toggle Button Group with View Transitions Morphing Highlight
- 04Tailwind Pricing Toggle — Monthly / Yearly Billing Switch (No JS)
- 05Tailwind Segmented Control with Sliding Thumb (iOS Style)
- 06Tailwind Split Button Dropdown with Native Details Menu (Save Options)
- 07Tailwind Icon Button Group Toolbar with Tooltips (Rich Text Editor)
- 08Tailwind Pill Filter Button Group with Sliding Indicator (Anchor Positioning)
- 09Tailwind Toggle Button Group for Text Alignment (Radio Inputs, Live Preview)
- 10Tailwind Web3 Connect Wallet Button Grid (Wallet Sign-In Modal)
- 11Tailwind AI Model Selector Button Group (LLM Model Picker with Badges)
- 12Tailwind Liquid Metal Segmented Control (Animated Chrome Thumb)
- 13Tailwind Tab Button Group with Subgrid Underline Indicator
- 14Tailwind Multi-Select Chip Buttons (Tag Filter Checkboxes with Count)
- 15Tailwind Animated Split Button Deploy Menu (Staggered Dropdown Reveal)
- 16Tailwind Radio Button Group with Conic Fill Animation (Export Format Picker)
- 17Tailwind Retro LED Pixel Button Group (Dot-Matrix Display Buttons)
- 18Tailwind Hold-to-Confirm Button Group with Gradient Progress (Press and Hold)
- 19Tailwind Holographic Icon Segmented Control (Grid / List View Switcher)
- 20Tailwind 3D Vertical Button Group with Hover Depth (Perspective Stack)
- 21Tailwind Floating Action Button with Radial Speed Dial Menu (No JS)
- 22Tailwind Glitch Effect Button Group (Cyberpunk RGB-Split Audio Filter)
- 23Tailwind Animated Gradient Border Pill Buttons (Rotating Conic Ring)
- 24Tailwind Button Group with Ripple Click Effect (Radar Shockwave Feedback)
- 25Tailwind Button Group with Cursor-Following Spotlight Glow (Date Range Presets)
Tailwind Pill Filter Button Group with Sliding Indicator (Anchor Positioning)
Category filter pills of different widths with a single highlight that glides to whichever is checked — and resizes to fit it. The CSS original hard-coded every pill's pixel offset; this port lets CSS Anchor Positioning measure instead: the checked pill gets has-checked:[anchor-name:--tbg08-on] and the indicator sizes itself with w-[anchor-size(width)]. Change a label, add a count, swap the font — it still lines up.
Untitled UI Pro: 5,000+ React + Tailwind CSS v4 components · from $349 one-time
Untitled UI React · Affiliate link
The code
<section class="tbg-08 w-full min-h-svh grid place-items-center bg-tbg08-bg bg-[radial-gradient(130%_130%_at_20%_0%,var(--color-tbg08-glow),transparent_70%)] px-5 py-14 font-tbg08-sans text-white" aria-label="Pill filter button group demo">
<div class="grid w-full max-w-[36rem] gap-3.5">
<p id="tbg08-label" class="ml-1 text-xs font-bold uppercase tracking-[0.14em] text-tbg08-acc-l">Browse by team</p>
<div role="radiogroup" aria-labelledby="tbg08-label" class="relative flex w-fit max-w-full flex-wrap gap-1 rounded-[1.75rem] border border-white/12 bg-white/5 p-1 backdrop-blur-sm">
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only" checked>All <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">48</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Design <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">12</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Engineering <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">21</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Growth <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">9</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Support <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">6</span></label>
<span aria-hidden="true" class="pointer-events-none absolute z-0 rounded-full bg-tbg08-acc shadow-[0_4px_18px_-4px_var(--color-tbg08-acc)] [position-anchor:--tbg08-on] top-[anchor(top)] left-[anchor(left)] h-[anchor-size(height)] w-[anchor-size(width)] transition-all duration-400 ease-[cubic-bezier(.34,1.3,.5,1)] motion-reduce:transition-none not-supports-[anchor-name:--x]:hidden"></span>
</div>
</div>
</section><section class="tbg-08 w-full min-h-svh grid place-items-center bg-tbg08-bg bg-[radial-gradient(130%_130%_at_20%_0%,var(--color-tbg08-glow),transparent_70%)] px-5 py-14 font-tbg08-sans text-white" aria-label="Pill filter button group demo">
<div class="grid w-full max-w-[36rem] gap-3.5">
<p id="tbg08-label" class="ml-1 text-xs font-bold uppercase tracking-[0.14em] text-tbg08-acc-l">Browse by team</p>
<div role="radiogroup" aria-labelledby="tbg08-label" class="relative flex w-fit max-w-full flex-wrap gap-1 rounded-[1.75rem] border border-white/12 bg-white/5 p-1 backdrop-blur-sm">
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only" checked>All <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">48</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Design <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">12</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Engineering <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">21</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Growth <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">9</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Support <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">6</span></label>
<span aria-hidden="true" class="pointer-events-none absolute z-0 rounded-full bg-tbg08-acc shadow-[0_4px_18px_-4px_var(--color-tbg08-acc)] [position-anchor:--tbg08-on] top-[anchor(top)] left-[anchor(left)] h-[anchor-size(height)] w-[anchor-size(width)] transition-all duration-400 ease-[cubic-bezier(.34,1.3,.5,1)] motion-reduce:transition-none not-supports-[anchor-name:--x]:hidden"></span>
</div>
</div>
</section>@import "tailwindcss";
@theme {
--color-tbg08-bg: #160820;
--color-tbg08-glow: #2e1135;
--color-tbg08-acc: #d8337f;
--color-tbg08-acc: oklch(0.6 0.21 355);
--color-tbg08-acc-l: #ff8cc1;
--color-tbg08-acc-l: oklch(0.78 0.14 355);
--font-tbg08-sans: 'Outfit', system-ui, sans-serif;
}
/* Root rule: the full-bleed contract, restated so the stage is sized before the browser build compiles. */
.tbg-08 {
width: 100%;
min-height: 100svh;
}@import "tailwindcss";
@theme {
--color-tbg08-bg: #160820;
--color-tbg08-glow: #2e1135;
--color-tbg08-acc: #d8337f;
--color-tbg08-acc: oklch(0.6 0.21 355);
--color-tbg08-acc-l: #ff8cc1;
--color-tbg08-acc-l: oklch(0.78 0.14 355);
--font-tbg08-sans: 'Outfit', system-ui, sans-serif;
}
/* Root rule: the full-bleed contract, restated so the stage is sized before the browser build compiles. */
.tbg-08 {
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-tbg08-bg: #160820;
--color-tbg08-glow: #2e1135;
--color-tbg08-acc: #d8337f;
--color-tbg08-acc: oklch(0.6 0.21 355);
--color-tbg08-acc-l: #ff8cc1;
--color-tbg08-acc-l: oklch(0.78 0.14 355);
--font-tbg08-sans: 'Outfit', system-ui, sans-serif;
}
/* Root rule: the full-bleed contract, restated so the stage is sized before the browser build compiles. */
.tbg-08 {
width: 100%;
min-height: 100svh;
}@import "tailwindcss";
@theme {
--color-tbg08-bg: #160820;
--color-tbg08-glow: #2e1135;
--color-tbg08-acc: #d8337f;
--color-tbg08-acc: oklch(0.6 0.21 355);
--color-tbg08-acc-l: #ff8cc1;
--color-tbg08-acc-l: oklch(0.78 0.14 355);
--font-tbg08-sans: 'Outfit', system-ui, sans-serif;
}
/* Root rule: the full-bleed contract, restated so the stage is sized before the browser build compiles. */
.tbg-08 {
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=Outfit:wght@400..800&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=Outfit:wght@400..800&display=swap">What changed in the port
Which parts became utilities, which stayed CSS, and why.
- Four hand-measured
--x/--wpairs (one per pill, in pixels) were deleted — anchor positioning measures the checked pill instead. input:checked + labelbecamehas-checked:on labels that wrap their radio.- UI upgrade: the indicator now fits any label length, font or language and follows pills when they wrap on phones — the original misaligned as soon as a font fell back.
- UI upgrade: pills gained result counts, a fifth category, and the accent darkened so white text on the indicator reaches 4.6:1 (was 3.2:1).
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: Tailwind Pill Filter Button Group with Sliding Indicator (Anchor Positioning)
Source: https://codefronts.com/components/tailwind-css-button-groups/tailwind-pill-filter-buttons-sliding-indicator/
Category filter pills of different widths with a single highlight that glides to whichever is checked — and resizes to fit it. The CSS original hard-coded every pill's pixel offset; this port lets CSS Anchor Positioning measure instead: the checked pill gets has-checked:[anchor-name:--tbg08-on] and the indicator sizes itself with w-[anchor-size(width)]. Change a label, add a count, swap the font — it still lines up.
## HTML
```html
<section class="tbg-08 w-full min-h-svh grid place-items-center bg-tbg08-bg bg-[radial-gradient(130%_130%_at_20%_0%,var(--color-tbg08-glow),transparent_70%)] px-5 py-14 font-tbg08-sans text-white" aria-label="Pill filter button group demo">
<div class="grid w-full max-w-[36rem] gap-3.5">
<p id="tbg08-label" class="ml-1 text-xs font-bold uppercase tracking-[0.14em] text-tbg08-acc-l">Browse by team</p>
<div role="radiogroup" aria-labelledby="tbg08-label" class="relative flex w-fit max-w-full flex-wrap gap-1 rounded-[1.75rem] border border-white/12 bg-white/5 p-1 backdrop-blur-sm">
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only" checked>All <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">48</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Design <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">12</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Engineering <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">21</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Growth <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">9</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Support <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">6</span></label>
<span aria-hidden="true" class="pointer-events-none absolute z-0 rounded-full bg-tbg08-acc shadow-[0_4px_18px_-4px_var(--color-tbg08-acc)] [position-anchor:--tbg08-on] top-[anchor(top)] left-[anchor(left)] h-[anchor-size(height)] w-[anchor-size(width)] transition-all duration-400 ease-[cubic-bezier(.34,1.3,.5,1)] motion-reduce:transition-none not-supports-[anchor-name:--x]:hidden"></span>
</div>
</div>
</section>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-tbg08-bg: #160820;
--color-tbg08-glow: #2e1135;
--color-tbg08-acc: #d8337f;
--color-tbg08-acc: oklch(0.6 0.21 355);
--color-tbg08-acc-l: #ff8cc1;
--color-tbg08-acc-l: oklch(0.78 0.14 355);
--font-tbg08-sans: 'Outfit', system-ui, sans-serif;
}
/* Root rule: the full-bleed contract, restated so the stage is sized before the browser build compiles. */
.tbg-08 {
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: Tailwind Pill Filter Button Group with Sliding Indicator (Anchor Positioning)
Source: https://codefronts.com/components/tailwind-css-button-groups/tailwind-pill-filter-buttons-sliding-indicator/
Category filter pills of different widths with a single highlight that glides to whichever is checked — and resizes to fit it. The CSS original hard-coded every pill's pixel offset; this port lets CSS Anchor Positioning measure instead: the checked pill gets has-checked:[anchor-name:--tbg08-on] and the indicator sizes itself with w-[anchor-size(width)]. Change a label, add a count, swap the font — it still lines up.
## HTML
```html
<section class="tbg-08 w-full min-h-svh grid place-items-center bg-tbg08-bg bg-[radial-gradient(130%_130%_at_20%_0%,var(--color-tbg08-glow),transparent_70%)] px-5 py-14 font-tbg08-sans text-white" aria-label="Pill filter button group demo">
<div class="grid w-full max-w-[36rem] gap-3.5">
<p id="tbg08-label" class="ml-1 text-xs font-bold uppercase tracking-[0.14em] text-tbg08-acc-l">Browse by team</p>
<div role="radiogroup" aria-labelledby="tbg08-label" class="relative flex w-fit max-w-full flex-wrap gap-1 rounded-[1.75rem] border border-white/12 bg-white/5 p-1 backdrop-blur-sm">
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only" checked>All <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">48</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Design <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">12</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Engineering <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">21</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Growth <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">9</span></label>
<label class="group/p relative z-1 flex min-h-11 cursor-pointer items-center gap-2 rounded-full px-4.5 text-[14.5px] font-semibold text-white/72 transition-colors duration-300 hover:text-white has-checked:text-white has-checked:[anchor-name:--tbg08-on] has-focus-visible:outline-3 has-focus-visible:outline-offset-2 has-focus-visible:outline-tbg08-acc-l not-supports-[anchor-name:--x]:has-checked:bg-tbg08-acc"><input type="radio" name="tbg08" class="sr-only">Support <span class="rounded-full bg-white/10 px-1.5 text-[11px] tabular-nums group-has-checked/p:bg-white/25">6</span></label>
<span aria-hidden="true" class="pointer-events-none absolute z-0 rounded-full bg-tbg08-acc shadow-[0_4px_18px_-4px_var(--color-tbg08-acc)] [position-anchor:--tbg08-on] top-[anchor(top)] left-[anchor(left)] h-[anchor-size(height)] w-[anchor-size(width)] transition-all duration-400 ease-[cubic-bezier(.34,1.3,.5,1)] motion-reduce:transition-none not-supports-[anchor-name:--x]:hidden"></span>
</div>
</div>
</section>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-tbg08-bg: #160820;
--color-tbg08-glow: #2e1135;
--color-tbg08-acc: #d8337f;
--color-tbg08-acc: oklch(0.6 0.21 355);
--color-tbg08-acc-l: #ff8cc1;
--color-tbg08-acc-l: oklch(0.78 0.14 355);
--font-tbg08-sans: 'Outfit', system-ui, sans-serif;
}
/* Root rule: the full-bleed contract, restated so the stage is sized before the browser build compiles. */
.tbg-08 {
width: 100%;
min-height: 100svh;
}
```How this works
Let the browser measure. Only the checked pill is an anchor at any moment; the indicator is tethered to that name:
<label class="has-checked:[anchor-name:--tbg08-on]">…</label>
<span class="absolute [position-anchor:--tbg08-on]
top-[anchor(top)] left-[anchor(left)]
w-[anchor-size(width)] h-[anchor-size(height)]
transition-all duration-400">It wraps, too. Because positions are measured, pills can wrap onto a second row on phones and the indicator follows them there — impossible with the original's fixed offsets.
Make it yours
- Underline style: replace
h-[anchor-size(height)]withh-0.5andtop-[anchor(bottom)]. - Add or rename pills freely — nothing is measured by hand.
- Re-theme via
--color-tbg08-acc.
Gotchas — read before shipping
- The indicator must come after the pills in the DOM so they are valid anchors for it.
- Anchor names are global — rename
--tbg08-onfor each group on a page (or useanchor-scope). - Some engines jump rather than glide when the anchor changes; the result is still correct.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 125+ | 26+ | 147+ | 125+ |
Anchor Positioning is required for the sliding indicator; elsewhere not-supports-[anchor-name:--x]: fills the checked pill directly.