06 / 32
All 32 in 32 Tailwind CSS Tabs
- 01Tailwind CSS Tabs with Sliding Underline Indicator
- 02Neon Glow Tailwind Tabs with Per-Tab Accent Colors
- 03Neo-Brutalist Tailwind Tabs with Press Effect
- 04Color-Coded Tailwind CSS Tabs Component
- 05VS Code Style File Tabs in Tailwind CSS
- 06iOS Segmented Control in Tailwind CSS
- 07Bento Grid Card Tabs in Tailwind CSS
- 08Vertical Tabs with Timeline Progress in Tailwind CSS
- 09Terminal Window Tabs in Tailwind CSS (Retro CRT)
- 10Expanding Icon Tabs in Tailwind CSS
- 11Typewriter Animation Tabs in Tailwind CSS
- 12Tailwind Tabs with Particle Burst Animation
- 13Animated Counter Tabs in Tailwind CSS (Type Specimen)
- 14Oversized Cropped Text Tabs in Tailwind CSS
- 15Tailwind Sidebar Navigation with Sliding Indicator
- 16Tailwind Bottom Navigation Bar with Expanding Labels
- 17Variable Font Weight Tabs in Tailwind CSS
- 18Uppercase Tabs with Thick Sliding Bar in Tailwind CSS
- 19Drop Cap Initial Letter Tabs in Tailwind CSS
- 20Industrial Stencil Tabs in Tailwind CSS
- 21Bracket Selection Tabs in Tailwind CSS
- 22Bauhaus Color Block Tabs in Tailwind CSS
- 23Inverted Rubber Stamp Tabs in Tailwind CSS
- 24Outlined Tabs with Corner Markers in Tailwind CSS
- 25Tailwind Pill Tab Bar with Icons
- 26Risograph Print Effect Tabs in Tailwind CSS
- 27Animated SVG Underline Tabs in Tailwind CSS
- 28Font Specimen Glyph Tabs in Tailwind CSS
- 29Sliding Pill Tabs with Icons in Tailwind CSS
- 30Folded Corner Tabs in Tailwind CSS (clip-path)
- 31Bookmark Ribbon Navigation in Tailwind CSS
- 32Neumorphic Inset Tabs in Tailwind CSS
iOS Segmented Control in Tailwind CSS
Apple's segmented control: a grey track, a white thumb that slides between segments, and the hairline dividers iOS draws between unselected segments. The port deletes the measuring script — the thumb moves with translate-x-[calc(var(--i)*100%)] — and adds the divider detail with an arbitrary sibling variant.
Untitled UI Pro: 5,000+ React + Tailwind CSS v4 components · from $349 one-time
Untitled UI React · Affiliate link
The code
<section class="ttb-06 group/tabs grid min-h-svh w-full place-items-center bg-ttb06-bg px-5 py-14 font-ttb06-sans text-ttb06-ink" aria-label="iOS segmented control demo">
<div class="grid w-full max-w-sm justify-items-center gap-7">
<div class="w-full rounded-[22px] bg-white p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04),0_12px_30px_-12px_rgb(0_0_0/0.15)]">
<div role="radiogroup" aria-label="Calendar range" class="relative flex rounded-[9px] bg-ttb06-track p-0.5 [--i:0] has-[#ttb06-r2:checked]:[--i:1] has-[#ttb06-r3:checked]:[--i:2]">
<label class="relative z-10 flex min-h-8 flex-1 cursor-pointer items-center justify-center rounded-[7px] text-[13px] font-medium transition-[font-weight] has-checked:font-semibold has-focus-visible:outline-2 has-focus-visible:outline-ttb06-acc"><input class="sr-only" type="radio" name="ttb06" id="ttb06-r1" checked>Day</label>
<label class="relative z-10 flex min-h-8 flex-1 cursor-pointer items-center justify-center rounded-[7px] text-[13px] font-medium transition-[font-weight] before:absolute before:inset-y-2 before:left-0 before:w-px before:bg-black/12 before:transition-opacity has-checked:font-semibold has-checked:before:opacity-0 has-focus-visible:outline-2 has-focus-visible:outline-ttb06-acc [:has(:checked)+&]:before:opacity-0"><input class="sr-only" type="radio" name="ttb06" id="ttb06-r2">Week</label>
<label class="relative z-10 flex min-h-8 flex-1 cursor-pointer items-center justify-center rounded-[7px] text-[13px] font-medium transition-[font-weight] before:absolute before:inset-y-2 before:left-0 before:w-px before:bg-black/12 before:transition-opacity has-checked:font-semibold has-checked:before:opacity-0 has-focus-visible:outline-2 has-focus-visible:outline-ttb06-acc [:has(:checked)+&]:before:opacity-0"><input class="sr-only" type="radio" name="ttb06" id="ttb06-r3">Month</label>
<span aria-hidden="true" class="pointer-events-none absolute inset-y-0.5 left-0.5 w-[calc((100%-4px)/3)] translate-x-[calc(var(--i)*100%)] rounded-[7px] bg-white shadow-[0_3px_8px_rgb(0_0_0/0.12),0_1px_1px_rgb(0_0_0/0.04)] ring-[0.5px] ring-black/4 transition-transform duration-[340ms] ease-[cubic-bezier(0.4,0,0.2,1)] motion-reduce:transition-none"></span>
</div>
<div class="mt-4 min-h-[88px]">
<div class="hidden group-has-[#ttb06-r1:checked]/tabs:block"><p class="text-[22px] font-bold tracking-tight">Today</p><p class="mt-1 text-[15px] text-ttb06-mut">3 events · first at 9:30</p></div>
<div class="hidden group-has-[#ttb06-r2:checked]/tabs:block"><p class="text-[22px] font-bold tracking-tight">This week</p><p class="mt-1 text-[15px] text-ttb06-mut">11 events across 5 days</p></div>
<div class="hidden group-has-[#ttb06-r3:checked]/tabs:block"><p class="text-[22px] font-bold tracking-tight">This month</p><p class="mt-1 text-[15px] text-ttb06-mut">38 events · 4 all-day</p></div>
</div>
</div>
<p aria-hidden="true" class="rounded-full bg-white px-3.5 py-2 font-ttb06-mono text-[11.5px] text-ttb06-mut shadow-sm">CSS thumb · [:has(:checked)+&]:before:opacity-0 dividers</p>
</div>
</section><section class="ttb-06 group/tabs grid min-h-svh w-full place-items-center bg-ttb06-bg px-5 py-14 font-ttb06-sans text-ttb06-ink" aria-label="iOS segmented control demo">
<div class="grid w-full max-w-sm justify-items-center gap-7">
<div class="w-full rounded-[22px] bg-white p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04),0_12px_30px_-12px_rgb(0_0_0/0.15)]">
<div role="radiogroup" aria-label="Calendar range" class="relative flex rounded-[9px] bg-ttb06-track p-0.5 [--i:0] has-[#ttb06-r2:checked]:[--i:1] has-[#ttb06-r3:checked]:[--i:2]">
<label class="relative z-10 flex min-h-8 flex-1 cursor-pointer items-center justify-center rounded-[7px] text-[13px] font-medium transition-[font-weight] has-checked:font-semibold has-focus-visible:outline-2 has-focus-visible:outline-ttb06-acc"><input class="sr-only" type="radio" name="ttb06" id="ttb06-r1" checked>Day</label>
<label class="relative z-10 flex min-h-8 flex-1 cursor-pointer items-center justify-center rounded-[7px] text-[13px] font-medium transition-[font-weight] before:absolute before:inset-y-2 before:left-0 before:w-px before:bg-black/12 before:transition-opacity has-checked:font-semibold has-checked:before:opacity-0 has-focus-visible:outline-2 has-focus-visible:outline-ttb06-acc [:has(:checked)+&]:before:opacity-0"><input class="sr-only" type="radio" name="ttb06" id="ttb06-r2">Week</label>
<label class="relative z-10 flex min-h-8 flex-1 cursor-pointer items-center justify-center rounded-[7px] text-[13px] font-medium transition-[font-weight] before:absolute before:inset-y-2 before:left-0 before:w-px before:bg-black/12 before:transition-opacity has-checked:font-semibold has-checked:before:opacity-0 has-focus-visible:outline-2 has-focus-visible:outline-ttb06-acc [:has(:checked)+&]:before:opacity-0"><input class="sr-only" type="radio" name="ttb06" id="ttb06-r3">Month</label>
<span aria-hidden="true" class="pointer-events-none absolute inset-y-0.5 left-0.5 w-[calc((100%-4px)/3)] translate-x-[calc(var(--i)*100%)] rounded-[7px] bg-white shadow-[0_3px_8px_rgb(0_0_0/0.12),0_1px_1px_rgb(0_0_0/0.04)] ring-[0.5px] ring-black/4 transition-transform duration-[340ms] ease-[cubic-bezier(0.4,0,0.2,1)] motion-reduce:transition-none"></span>
</div>
<div class="mt-4 min-h-[88px]">
<div class="hidden group-has-[#ttb06-r1:checked]/tabs:block"><p class="text-[22px] font-bold tracking-tight">Today</p><p class="mt-1 text-[15px] text-ttb06-mut">3 events · first at 9:30</p></div>
<div class="hidden group-has-[#ttb06-r2:checked]/tabs:block"><p class="text-[22px] font-bold tracking-tight">This week</p><p class="mt-1 text-[15px] text-ttb06-mut">11 events across 5 days</p></div>
<div class="hidden group-has-[#ttb06-r3:checked]/tabs:block"><p class="text-[22px] font-bold tracking-tight">This month</p><p class="mt-1 text-[15px] text-ttb06-mut">38 events · 4 all-day</p></div>
</div>
</div>
<p aria-hidden="true" class="rounded-full bg-white px-3.5 py-2 font-ttb06-mono text-[11.5px] text-ttb06-mut shadow-sm">CSS thumb · [:has(:checked)+&]:before:opacity-0 dividers</p>
</div>
</section>@import "tailwindcss";
@theme {
--color-ttb06-bg: #f2f2f7;
--color-ttb06-bg: oklch(0.963 0.007 286.3);
--color-ttb06-track: #e3e3e8;
--color-ttb06-track: oklch(0.917 0.007 286.3);
--color-ttb06-ink: #1c1c1e;
--color-ttb06-ink: oklch(0.227 0.004 286.1);
--color-ttb06-mut: #636366;
--color-ttb06-mut: oklch(0.501 0.005 286.2);
--color-ttb06-acc: #007aff;
--color-ttb06-acc: oklch(0.603 0.218 257.4);
--font-ttb06-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
--font-ttb06-mono: 'Geist Mono', ui-monospace, monospace;
}
/* 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-06 {
width: 100%;
min-height: 100svh;
}@import "tailwindcss";
@theme {
--color-ttb06-bg: #f2f2f7;
--color-ttb06-bg: oklch(0.963 0.007 286.3);
--color-ttb06-track: #e3e3e8;
--color-ttb06-track: oklch(0.917 0.007 286.3);
--color-ttb06-ink: #1c1c1e;
--color-ttb06-ink: oklch(0.227 0.004 286.1);
--color-ttb06-mut: #636366;
--color-ttb06-mut: oklch(0.501 0.005 286.2);
--color-ttb06-acc: #007aff;
--color-ttb06-acc: oklch(0.603 0.218 257.4);
--font-ttb06-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
--font-ttb06-mono: 'Geist Mono', ui-monospace, monospace;
}
/* 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-06 {
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-ttb06-bg: #f2f2f7;
--color-ttb06-bg: oklch(0.963 0.007 286.3);
--color-ttb06-track: #e3e3e8;
--color-ttb06-track: oklch(0.917 0.007 286.3);
--color-ttb06-ink: #1c1c1e;
--color-ttb06-ink: oklch(0.227 0.004 286.1);
--color-ttb06-mut: #636366;
--color-ttb06-mut: oklch(0.501 0.005 286.2);
--color-ttb06-acc: #007aff;
--color-ttb06-acc: oklch(0.603 0.218 257.4);
--font-ttb06-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
--font-ttb06-mono: 'Geist Mono', ui-monospace, monospace;
}
/* 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-06 {
width: 100%;
min-height: 100svh;
}@import "tailwindcss";
@theme {
--color-ttb06-bg: #f2f2f7;
--color-ttb06-bg: oklch(0.963 0.007 286.3);
--color-ttb06-track: #e3e3e8;
--color-ttb06-track: oklch(0.917 0.007 286.3);
--color-ttb06-ink: #1c1c1e;
--color-ttb06-ink: oklch(0.227 0.004 286.1);
--color-ttb06-mut: #636366;
--color-ttb06-mut: oklch(0.501 0.005 286.2);
--color-ttb06-acc: #007aff;
--color-ttb06-acc: oklch(0.603 0.218 257.4);
--font-ttb06-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
--font-ttb06-mono: 'Geist Mono', ui-monospace, monospace;
}
/* 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-06 {
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=Geist+Mono:wght@400..600&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=Geist+Mono:wght@400..600&display=swap">What changed in the port
Which parts became utilities, which stayed CSS, and why.
- The 30-line measuring controller is gone: the thumb is
w-[calc((100%-4px)/3)] translate-x-[calc(var(--i)*100%)], the index comes fromhas-[#…:checked]:[--i:N]. - The thumb now animates
transforminstead ofleft+width— compositor-only, no layout per frame. - UI upgrade from the CSS original: real iOS divider hairlines between unselected segments, hidden beside the thumb via
[:has(:checked)+&]:before:opacity-0, and the active label gains semibold weight like UIKit. - UI upgrade: the control sits in a calendar card with a live summary panel; no misaligned-thumb flash before scripts load, because there are none.
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: iOS Segmented Control in Tailwind CSS
Source: https://codefronts.com/navigation/tailwind-css-tabs/ios-segmented-control-tailwind-css/
Apple's segmented control: a grey track, a white thumb that slides between segments, and the hairline dividers iOS draws between unselected segments. The port deletes the measuring script — the thumb moves with translate-x-[calc(var(--i)*100%)] — and adds the divider detail with an arbitrary sibling variant.
## HTML
```html
<section class="ttb-06 group/tabs grid min-h-svh w-full place-items-center bg-ttb06-bg px-5 py-14 font-ttb06-sans text-ttb06-ink" aria-label="iOS segmented control demo">
<div class="grid w-full max-w-sm justify-items-center gap-7">
<div class="w-full rounded-[22px] bg-white p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04),0_12px_30px_-12px_rgb(0_0_0/0.15)]">
<div role="radiogroup" aria-label="Calendar range" class="relative flex rounded-[9px] bg-ttb06-track p-0.5 [--i:0] has-[#ttb06-r2:checked]:[--i:1] has-[#ttb06-r3:checked]:[--i:2]">
<label class="relative z-10 flex min-h-8 flex-1 cursor-pointer items-center justify-center rounded-[7px] text-[13px] font-medium transition-[font-weight] has-checked:font-semibold has-focus-visible:outline-2 has-focus-visible:outline-ttb06-acc"><input class="sr-only" type="radio" name="ttb06" id="ttb06-r1" checked>Day</label>
<label class="relative z-10 flex min-h-8 flex-1 cursor-pointer items-center justify-center rounded-[7px] text-[13px] font-medium transition-[font-weight] before:absolute before:inset-y-2 before:left-0 before:w-px before:bg-black/12 before:transition-opacity has-checked:font-semibold has-checked:before:opacity-0 has-focus-visible:outline-2 has-focus-visible:outline-ttb06-acc [:has(:checked)+&]:before:opacity-0"><input class="sr-only" type="radio" name="ttb06" id="ttb06-r2">Week</label>
<label class="relative z-10 flex min-h-8 flex-1 cursor-pointer items-center justify-center rounded-[7px] text-[13px] font-medium transition-[font-weight] before:absolute before:inset-y-2 before:left-0 before:w-px before:bg-black/12 before:transition-opacity has-checked:font-semibold has-checked:before:opacity-0 has-focus-visible:outline-2 has-focus-visible:outline-ttb06-acc [:has(:checked)+&]:before:opacity-0"><input class="sr-only" type="radio" name="ttb06" id="ttb06-r3">Month</label>
<span aria-hidden="true" class="pointer-events-none absolute inset-y-0.5 left-0.5 w-[calc((100%-4px)/3)] translate-x-[calc(var(--i)*100%)] rounded-[7px] bg-white shadow-[0_3px_8px_rgb(0_0_0/0.12),0_1px_1px_rgb(0_0_0/0.04)] ring-[0.5px] ring-black/4 transition-transform duration-[340ms] ease-[cubic-bezier(0.4,0,0.2,1)] motion-reduce:transition-none"></span>
</div>
<div class="mt-4 min-h-[88px]">
<div class="hidden group-has-[#ttb06-r1:checked]/tabs:block"><p class="text-[22px] font-bold tracking-tight">Today</p><p class="mt-1 text-[15px] text-ttb06-mut">3 events · first at 9:30</p></div>
<div class="hidden group-has-[#ttb06-r2:checked]/tabs:block"><p class="text-[22px] font-bold tracking-tight">This week</p><p class="mt-1 text-[15px] text-ttb06-mut">11 events across 5 days</p></div>
<div class="hidden group-has-[#ttb06-r3:checked]/tabs:block"><p class="text-[22px] font-bold tracking-tight">This month</p><p class="mt-1 text-[15px] text-ttb06-mut">38 events · 4 all-day</p></div>
</div>
</div>
<p aria-hidden="true" class="rounded-full bg-white px-3.5 py-2 font-ttb06-mono text-[11.5px] text-ttb06-mut shadow-sm">CSS thumb · [:has(:checked)+&]:before:opacity-0 dividers</p>
</div>
</section>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-ttb06-bg: #f2f2f7;
--color-ttb06-bg: oklch(0.963 0.007 286.3);
--color-ttb06-track: #e3e3e8;
--color-ttb06-track: oklch(0.917 0.007 286.3);
--color-ttb06-ink: #1c1c1e;
--color-ttb06-ink: oklch(0.227 0.004 286.1);
--color-ttb06-mut: #636366;
--color-ttb06-mut: oklch(0.501 0.005 286.2);
--color-ttb06-acc: #007aff;
--color-ttb06-acc: oklch(0.603 0.218 257.4);
--font-ttb06-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
--font-ttb06-mono: 'Geist Mono', ui-monospace, monospace;
}
/* 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-06 {
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: iOS Segmented Control in Tailwind CSS
Source: https://codefronts.com/navigation/tailwind-css-tabs/ios-segmented-control-tailwind-css/
Apple's segmented control: a grey track, a white thumb that slides between segments, and the hairline dividers iOS draws between unselected segments. The port deletes the measuring script — the thumb moves with translate-x-[calc(var(--i)*100%)] — and adds the divider detail with an arbitrary sibling variant.
## HTML
```html
<section class="ttb-06 group/tabs grid min-h-svh w-full place-items-center bg-ttb06-bg px-5 py-14 font-ttb06-sans text-ttb06-ink" aria-label="iOS segmented control demo">
<div class="grid w-full max-w-sm justify-items-center gap-7">
<div class="w-full rounded-[22px] bg-white p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04),0_12px_30px_-12px_rgb(0_0_0/0.15)]">
<div role="radiogroup" aria-label="Calendar range" class="relative flex rounded-[9px] bg-ttb06-track p-0.5 [--i:0] has-[#ttb06-r2:checked]:[--i:1] has-[#ttb06-r3:checked]:[--i:2]">
<label class="relative z-10 flex min-h-8 flex-1 cursor-pointer items-center justify-center rounded-[7px] text-[13px] font-medium transition-[font-weight] has-checked:font-semibold has-focus-visible:outline-2 has-focus-visible:outline-ttb06-acc"><input class="sr-only" type="radio" name="ttb06" id="ttb06-r1" checked>Day</label>
<label class="relative z-10 flex min-h-8 flex-1 cursor-pointer items-center justify-center rounded-[7px] text-[13px] font-medium transition-[font-weight] before:absolute before:inset-y-2 before:left-0 before:w-px before:bg-black/12 before:transition-opacity has-checked:font-semibold has-checked:before:opacity-0 has-focus-visible:outline-2 has-focus-visible:outline-ttb06-acc [:has(:checked)+&]:before:opacity-0"><input class="sr-only" type="radio" name="ttb06" id="ttb06-r2">Week</label>
<label class="relative z-10 flex min-h-8 flex-1 cursor-pointer items-center justify-center rounded-[7px] text-[13px] font-medium transition-[font-weight] before:absolute before:inset-y-2 before:left-0 before:w-px before:bg-black/12 before:transition-opacity has-checked:font-semibold has-checked:before:opacity-0 has-focus-visible:outline-2 has-focus-visible:outline-ttb06-acc [:has(:checked)+&]:before:opacity-0"><input class="sr-only" type="radio" name="ttb06" id="ttb06-r3">Month</label>
<span aria-hidden="true" class="pointer-events-none absolute inset-y-0.5 left-0.5 w-[calc((100%-4px)/3)] translate-x-[calc(var(--i)*100%)] rounded-[7px] bg-white shadow-[0_3px_8px_rgb(0_0_0/0.12),0_1px_1px_rgb(0_0_0/0.04)] ring-[0.5px] ring-black/4 transition-transform duration-[340ms] ease-[cubic-bezier(0.4,0,0.2,1)] motion-reduce:transition-none"></span>
</div>
<div class="mt-4 min-h-[88px]">
<div class="hidden group-has-[#ttb06-r1:checked]/tabs:block"><p class="text-[22px] font-bold tracking-tight">Today</p><p class="mt-1 text-[15px] text-ttb06-mut">3 events · first at 9:30</p></div>
<div class="hidden group-has-[#ttb06-r2:checked]/tabs:block"><p class="text-[22px] font-bold tracking-tight">This week</p><p class="mt-1 text-[15px] text-ttb06-mut">11 events across 5 days</p></div>
<div class="hidden group-has-[#ttb06-r3:checked]/tabs:block"><p class="text-[22px] font-bold tracking-tight">This month</p><p class="mt-1 text-[15px] text-ttb06-mut">38 events · 4 all-day</p></div>
</div>
</div>
<p aria-hidden="true" class="rounded-full bg-white px-3.5 py-2 font-ttb06-mono text-[11.5px] text-ttb06-mut shadow-sm">CSS thumb · [:has(:checked)+&]:before:opacity-0 dividers</p>
</div>
</section>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-ttb06-bg: #f2f2f7;
--color-ttb06-bg: oklch(0.963 0.007 286.3);
--color-ttb06-track: #e3e3e8;
--color-ttb06-track: oklch(0.917 0.007 286.3);
--color-ttb06-ink: #1c1c1e;
--color-ttb06-ink: oklch(0.227 0.004 286.1);
--color-ttb06-mut: #636366;
--color-ttb06-mut: oklch(0.501 0.005 286.2);
--color-ttb06-acc: #007aff;
--color-ttb06-acc: oklch(0.603 0.218 257.4);
--font-ttb06-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
--font-ttb06-mono: 'Geist Mono', ui-monospace, monospace;
}
/* 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-06 {
width: 100%;
min-height: 100svh;
}
```How this works
The thumb is one segment wide. The track has 2px padding, so each segment is a third of 100% - 4px. Translating by its own width per index lands it exactly:
<span class="absolute inset-y-0.5 left-0.5 w-[calc((100%-4px)/3)]
translate-x-[calc(var(--i)*100%)] rounded-[7px] bg-white shadow-…">The iOS divider rule. Real segmented controls draw a hairline between unselected segments and hide it on either side of the thumb. Two variants say exactly that: hide it on the checked segment, and on the segment right after a checked one:
has-checked:before:opacity-0 [:has(:checked)+&]:before:opacity-0Make it yours
- Dark mode: track
bg-white/14, thumbbg-[#636366], labels white. - Two or four segments: change the thumb's divisor and the
--ilist. - Tint the thumb with a brand colour and flip the active label to white with
has-checked:text-white.
Gotchas — read before shipping
[:has(:checked)+&]relies on the labels being adjacent siblings — keep the thumb span after the last label, not between them.- The thumb's radius (7px) must be the track radius minus the 2px gap, or the inset looks uneven.
- Labels must sit above the thumb (
relative z-10) or the thumb covers the text.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 111+ | 16.4+ | 128+ | 111+ |
:has() drives the index and the dividers; inside Tailwind v4's floor.