51 Tailwind CSS Buttons
08 / 51

All 51 in 51 Tailwind CSS Buttons

  1. 01Tailwind Submit Button (Form Primary)
  2. 02Tailwind Primary and Secondary Button Pair
  3. 03Tailwind Ghost / Outline Button
  4. 04Tailwind Icon-Only Button with Accessible Tooltip
  5. 05Tailwind Gradient CTA Button
  6. 06Tailwind Loading Spinner Button (State Transition)
  7. 07Tailwind Disabled Button State (Full State Reference)
  8. 08Tailwind Button Group Component (Segmented Radio-Like)
  9. 09Tailwind Add to Cart Button
  10. 10Tailwind Download Progress Button
  11. 11Tailwind Like Heart Button
  12. 12Tailwind Confirm Delete Button
  13. 13Tailwind Play Pause Button
  14. 14Tailwind Subscribe Confetti Button
  15. 15Tailwind Magnetic Mercury Ripple Button
  16. 16Tailwind Brutalist Glitch Button
  17. 17Tailwind Neon Plasma Burst Button
  18. 18Tailwind Clay Press Button
  19. 19Tailwind Editorial Ink Spread Button
  20. 20Tailwind Particle Shard Burst Button
  21. 21Tailwind Brushed Brass Plate Button
  22. 22Tailwind Washi Paper Crane Button
  23. 23Tailwind Frosted Ice Cube Button
  24. 24Tailwind Vintage Typewriter Key Button
  25. 25Tailwind Lacquered Walnut Wood Button
  26. 26Tailwind Pharma Gel Capsule Button
  27. 27Tailwind Aged Copper Coin Button
  28. 28Tailwind Origami Fortune Cookie Button
  29. 29Tailwind Holographic Foil Sticker Button
  30. 30Tailwind Brutalist Concrete Slab Button
  31. 31Tailwind Mercury Bead Morph Button
  32. 32Tailwind Soft Pill Modern SaaS Button
  33. 33Tailwind Masking Tape Label Button
  34. 34Tailwind Obsidian Glass Shard Button
  35. 35Tailwind Wine Velvet Ribbon Button
  36. 36Tailwind LED Segment Display Button
  37. 37Tailwind Cassette Mixtape Label Button
  38. 38Tailwind Chalkboard Menu Button
  39. 39Tailwind Vinyl Record Sleeve Ripple Button
  40. 40Tailwind Polaroid Snapshot Button
  41. 41Tailwind Airline Boarding Pass Button
  42. 42Tailwind Aged Brass Subway Token Button
  43. 43Tailwind Vintage Rx Pharmacy Label Button
  44. 44Tailwind Bakelite Radio Dial Toggle Button
  45. 45Tailwind Regal Postage Stamp Button
  46. 46Tailwind Victorian Cigar Band Foil Button
  47. 47Tailwind Vintage Calculator Key Button
  48. 48Tailwind Toolbox Latch Spotlight Button
  49. 49Tailwind Receipt Paper Total Count-Up Button
  50. 50Tailwind IBM Punch Card Magnetic Follow Button
  51. 51Tailwind Brass Periscope Lens Button
Pure TailwindMIT licensed

Tailwind Button Group Component (Segmented Radio-Like)

A segmented control on real radio inputs, so arrow-key navigation, roving focus and form serialisation come from the platform. The sliding thumb tracks the checked segment, and the port makes the label's own inversion a has-checked: variant — the state is read where it is rendered, not from four rules at the bottom of a stylesheet.

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

<div class="tb-08 w-full min-h-svh grid place-items-center bg-tb08-bg font-tb08-sans antialiased p-[clamp(1.5rem,6vw,4rem)]">
  <div role="group" aria-label="Chart range" class="tb-08__group relative flex w-[min(100%,25rem)] p-[0.3rem] rounded-[1rem] bg-tb08-track shadow-[inset_0_1px_2px_var(--color-tb08-inset)] active:[&_.tb-08\_\_thumb]:scale-[0.97]">
    <span aria-hidden="true" class="tb-08__thumb absolute z-0 top-[0.3rem] left-[0.3rem] bottom-[0.3rem] w-[calc((100%-0.6rem)/4)] rounded-[0.7rem] bg-tb08-thumb shadow-[0_1px_2px_var(--color-tb08-shadow-1),0_6px_14px_-8px_var(--color-tb08-shadow-2)] transition-[translate,scale] duration-500 ease-tb08-spring motion-reduce:transition-none"></span>
    <label class="relative z-10 flex-1 cursor-pointer grid place-items-center min-h-11 px-2 rounded-[0.7rem] text-sm font-semibold tracking-[-0.005em] text-tb08-muted transition-colors duration-200 [-webkit-tap-highlight-color:transparent] hover:text-tb08-ink-soft has-checked:text-tb08-ink has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-tb08-accent motion-reduce:transition-none"><input type="radio" name="tb-08-range" value="day" class="sr-only"><span>Day</span></label>
    <label class="relative z-10 flex-1 cursor-pointer grid place-items-center min-h-11 px-2 rounded-[0.7rem] text-sm font-semibold tracking-[-0.005em] text-tb08-muted transition-colors duration-200 [-webkit-tap-highlight-color:transparent] hover:text-tb08-ink-soft has-checked:text-tb08-ink has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-tb08-accent motion-reduce:transition-none"><input type="radio" name="tb-08-range" value="week" checked class="sr-only"><span>Week</span></label>
    <label class="relative z-10 flex-1 cursor-pointer grid place-items-center min-h-11 px-2 rounded-[0.7rem] text-sm font-semibold tracking-[-0.005em] text-tb08-muted transition-colors duration-200 [-webkit-tap-highlight-color:transparent] hover:text-tb08-ink-soft has-checked:text-tb08-ink has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-tb08-accent motion-reduce:transition-none"><input type="radio" name="tb-08-range" value="month" class="sr-only"><span>Month</span></label>
    <label class="relative z-10 flex-1 cursor-pointer grid place-items-center min-h-11 px-2 rounded-[0.7rem] text-sm font-semibold tracking-[-0.005em] text-tb08-muted transition-colors duration-200 [-webkit-tap-highlight-color:transparent] hover:text-tb08-ink-soft has-checked:text-tb08-ink has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-tb08-accent motion-reduce:transition-none"><input type="radio" name="tb-08-range" value="year" class="sr-only"><span>Year</span></label>
  </div>
</div>
@import "tailwindcss";

@theme {
  --color-tb08-bg: #f1f2f4;
  --color-tb08-bg: oklch(0.958 0.004 265);
  --color-tb08-track: #e6e7ea;
  --color-tb08-track: oklch(0.925 0.005 265);
  --color-tb08-thumb: #ffffff;
  --color-tb08-ink: #0d0d12;
  --color-tb08-ink: oklch(0.15 0.008 280);
  --color-tb08-ink-soft: #3a3a45;
  --color-tb08-ink-soft: oklch(0.34 0.01 280);
  --color-tb08-muted: #55555f;
  --color-tb08-muted: oklch(0.45 0.012 280);
  --color-tb08-accent: #5b21b6;
  --color-tb08-accent: oklch(0.44 0.2 296);
  --color-tb08-inset: #0d0d121f;
  --color-tb08-inset: oklch(0.15 0.008 280 / 0.12);
  --color-tb08-shadow-1: #0d0d122e;
  --color-tb08-shadow-1: oklch(0.15 0.008 280 / 0.18);
  --color-tb08-shadow-2: #0d0d1266;
  --color-tb08-shadow-2: oklch(0.15 0.008 280 / 0.4);
  --font-tb08-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-tb08-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

@supports (transition-timing-function: linear(0, 1)) {
  @theme {
    --ease-tb08-spring: linear(0, 0.42 8%, 0.79 17%, 1.02 24%, 1.09 29%, 1.06 36%, 1 48%, 1);
  }
}

.tb-08 {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
}
/* Positional sibling state: which of four is checked. No Tailwind variant expresses this. */

.tb-08__group:has(label:nth-of-type(2) input:checked) .tb-08__thumb {
  translate: 100% 0;
}

.tb-08__group:has(label:nth-of-type(3) input:checked) .tb-08__thumb {
  translate: 200% 0;
}

.tb-08__group:has(label:nth-of-type(4) input:checked) .tb-08__thumb {
  translate: 300% 0;
}

@supports not selector(:has(*)) {
  .tb-08__thumb {
    display: none;
  }

  .tb-08 input:checked ~ span {
    color: var(--color-tb08-ink);
    text-decoration: underline;
    text-underline-offset: 0.4em;
  }
}

@media (prefers-color-scheme: dark) {
  .tb-08:not([data-theme="light"]) {
    --color-tb08-bg: oklch(0.12 0.006 280);
    --color-tb08-track: oklch(0.2 0.008 280);
    --color-tb08-thumb: oklch(0.32 0.012 280);
    --color-tb08-ink: oklch(0.97 0.003 280);
    --color-tb08-ink-soft: oklch(0.85 0.006 280);
    --color-tb08-muted: oklch(0.68 0.01 280);
    --color-tb08-accent: oklch(0.78 0.13 296);
  }
}

.tb-08[data-theme="dark"] {
  --color-tb08-bg: oklch(0.12 0.006 280);
  --color-tb08-track: oklch(0.2 0.008 280);
  --color-tb08-thumb: oklch(0.32 0.012 280);
  --color-tb08-ink: oklch(0.97 0.003 280);
  --color-tb08-muted: oklch(0.68 0.01 280);
}

@media (forced-colors: active) {
  .tb-08__group {
    border: 1px solid ButtonText;
  }

  .tb-08__thumb {
    background: Highlight;
  }

  .tb-08 label:has(input:checked) {
    color: HighlightText;
  }
}

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-tb08-bg: #f1f2f4;
  --color-tb08-bg: oklch(0.958 0.004 265);
  --color-tb08-track: #e6e7ea;
  --color-tb08-track: oklch(0.925 0.005 265);
  --color-tb08-thumb: #ffffff;
  --color-tb08-ink: #0d0d12;
  --color-tb08-ink: oklch(0.15 0.008 280);
  --color-tb08-ink-soft: #3a3a45;
  --color-tb08-ink-soft: oklch(0.34 0.01 280);
  --color-tb08-muted: #55555f;
  --color-tb08-muted: oklch(0.45 0.012 280);
  --color-tb08-accent: #5b21b6;
  --color-tb08-accent: oklch(0.44 0.2 296);
  --color-tb08-inset: #0d0d121f;
  --color-tb08-inset: oklch(0.15 0.008 280 / 0.12);
  --color-tb08-shadow-1: #0d0d122e;
  --color-tb08-shadow-1: oklch(0.15 0.008 280 / 0.18);
  --color-tb08-shadow-2: #0d0d1266;
  --color-tb08-shadow-2: oklch(0.15 0.008 280 / 0.4);
  --font-tb08-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-tb08-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

@supports (transition-timing-function: linear(0, 1)) {
  @theme {
    --ease-tb08-spring: linear(0, 0.42 8%, 0.79 17%, 1.02 24%, 1.09 29%, 1.06 36%, 1 48%, 1);
  }
}

.tb-08 {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
}
/* Positional sibling state: which of four is checked. No Tailwind variant expresses this. */

.tb-08__group:has(label:nth-of-type(2) input:checked) .tb-08__thumb {
  translate: 100% 0;
}

.tb-08__group:has(label:nth-of-type(3) input:checked) .tb-08__thumb {
  translate: 200% 0;
}

.tb-08__group:has(label:nth-of-type(4) input:checked) .tb-08__thumb {
  translate: 300% 0;
}

@supports not selector(:has(*)) {
  .tb-08__thumb {
    display: none;
  }

  .tb-08 input:checked ~ span {
    color: var(--color-tb08-ink);
    text-decoration: underline;
    text-underline-offset: 0.4em;
  }
}

@media (prefers-color-scheme: dark) {
  .tb-08:not([data-theme="light"]) {
    --color-tb08-bg: oklch(0.12 0.006 280);
    --color-tb08-track: oklch(0.2 0.008 280);
    --color-tb08-thumb: oklch(0.32 0.012 280);
    --color-tb08-ink: oklch(0.97 0.003 280);
    --color-tb08-ink-soft: oklch(0.85 0.006 280);
    --color-tb08-muted: oklch(0.68 0.01 280);
    --color-tb08-accent: oklch(0.78 0.13 296);
  }
}

.tb-08[data-theme="dark"] {
  --color-tb08-bg: oklch(0.12 0.006 280);
  --color-tb08-track: oklch(0.2 0.008 280);
  --color-tb08-thumb: oklch(0.32 0.012 280);
  --color-tb08-ink: oklch(0.97 0.003 280);
  --color-tb08-muted: oklch(0.68 0.01 280);
}

@media (forced-colors: active) {
  .tb-08__group {
    border: 1px solid ButtonText;
  }

  .tb-08__thumb {
    background: Highlight;
  }

  .tb-08 label:has(input:checked) {
    color: HighlightText;
  }
}
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=Manrope:wght@500;600;700&display=swap">

What changed in the port

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

  • Utilities: the track, the thumb's box and transition, and every per-label state — has-checked:, has-focus-visible:, hover. CSS: the three positional :has(label:nth-of-type(n) input:checked) rules and the @supports not selector(:has(*)) fallback.
  • This is the collection's clearest example of a port that should not go all the way. "Which of my four siblings is checked" is positional relational state; Tailwind has no variant for it, an arbitrary-selector escape hatch would be a :has() rule written sideways, and the CSS is three readable lines.
  • --ease-tb08-spring is re-declared inside @supports (transition-timing-function: linear(0,1)), which keeps the cubic-bezier fallback and the linear() spring behind one token name. The utility ease-tb08-spring never changes.
  • A11y fix from the CSS original: inactive segment labels were oklch(0.48 0.012 280) on the track — about 4.3:1. The port moves them to 0.45 lightness (≈5:1) and adds a distinct --color-tb08-ink-soft for hover, so the hover state no longer computes through color-mix().
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: Tailwind Button Group Component (Segmented Radio-Like)
Source: https://codefronts.com/components/tailwind-css-buttons/tailwind-button-group-component-segmented/

A segmented control on real radio inputs, so arrow-key navigation, roving focus and form serialisation come from the platform. The sliding thumb tracks the checked segment, and the port makes the label's own inversion a has-checked: variant — the state is read where it is rendered, not from four rules at the bottom of a stylesheet.
## HTML
```html
<div class="tb-08 w-full min-h-svh grid place-items-center bg-tb08-bg font-tb08-sans antialiased p-[clamp(1.5rem,6vw,4rem)]">
  <div role="group" aria-label="Chart range" class="tb-08__group relative flex w-[min(100%,25rem)] p-[0.3rem] rounded-[1rem] bg-tb08-track shadow-[inset_0_1px_2px_var(--color-tb08-inset)] active:[&_.tb-08\_\_thumb]:scale-[0.97]">
    <span aria-hidden="true" class="tb-08__thumb absolute z-0 top-[0.3rem] left-[0.3rem] bottom-[0.3rem] w-[calc((100%-0.6rem)/4)] rounded-[0.7rem] bg-tb08-thumb shadow-[0_1px_2px_var(--color-tb08-shadow-1),0_6px_14px_-8px_var(--color-tb08-shadow-2)] transition-[translate,scale] duration-500 ease-tb08-spring motion-reduce:transition-none"></span>
    <label class="relative z-10 flex-1 cursor-pointer grid place-items-center min-h-11 px-2 rounded-[0.7rem] text-sm font-semibold tracking-[-0.005em] text-tb08-muted transition-colors duration-200 [-webkit-tap-highlight-color:transparent] hover:text-tb08-ink-soft has-checked:text-tb08-ink has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-tb08-accent motion-reduce:transition-none"><input type="radio" name="tb-08-range" value="day" class="sr-only"><span>Day</span></label>
    <label class="relative z-10 flex-1 cursor-pointer grid place-items-center min-h-11 px-2 rounded-[0.7rem] text-sm font-semibold tracking-[-0.005em] text-tb08-muted transition-colors duration-200 [-webkit-tap-highlight-color:transparent] hover:text-tb08-ink-soft has-checked:text-tb08-ink has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-tb08-accent motion-reduce:transition-none"><input type="radio" name="tb-08-range" value="week" checked class="sr-only"><span>Week</span></label>
    <label class="relative z-10 flex-1 cursor-pointer grid place-items-center min-h-11 px-2 rounded-[0.7rem] text-sm font-semibold tracking-[-0.005em] text-tb08-muted transition-colors duration-200 [-webkit-tap-highlight-color:transparent] hover:text-tb08-ink-soft has-checked:text-tb08-ink has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-tb08-accent motion-reduce:transition-none"><input type="radio" name="tb-08-range" value="month" class="sr-only"><span>Month</span></label>
    <label class="relative z-10 flex-1 cursor-pointer grid place-items-center min-h-11 px-2 rounded-[0.7rem] text-sm font-semibold tracking-[-0.005em] text-tb08-muted transition-colors duration-200 [-webkit-tap-highlight-color:transparent] hover:text-tb08-ink-soft has-checked:text-tb08-ink has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-tb08-accent motion-reduce:transition-none"><input type="radio" name="tb-08-range" value="year" class="sr-only"><span>Year</span></label>
  </div>
</div>
```
## CSS
```css
@import "tailwindcss";

@theme {
  --color-tb08-bg: #f1f2f4;
  --color-tb08-bg: oklch(0.958 0.004 265);
  --color-tb08-track: #e6e7ea;
  --color-tb08-track: oklch(0.925 0.005 265);
  --color-tb08-thumb: #ffffff;
  --color-tb08-ink: #0d0d12;
  --color-tb08-ink: oklch(0.15 0.008 280);
  --color-tb08-ink-soft: #3a3a45;
  --color-tb08-ink-soft: oklch(0.34 0.01 280);
  --color-tb08-muted: #55555f;
  --color-tb08-muted: oklch(0.45 0.012 280);
  --color-tb08-accent: #5b21b6;
  --color-tb08-accent: oklch(0.44 0.2 296);
  --color-tb08-inset: #0d0d121f;
  --color-tb08-inset: oklch(0.15 0.008 280 / 0.12);
  --color-tb08-shadow-1: #0d0d122e;
  --color-tb08-shadow-1: oklch(0.15 0.008 280 / 0.18);
  --color-tb08-shadow-2: #0d0d1266;
  --color-tb08-shadow-2: oklch(0.15 0.008 280 / 0.4);
  --font-tb08-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-tb08-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

@supports (transition-timing-function: linear(0, 1)) {
  @theme {
    --ease-tb08-spring: linear(0, 0.42 8%, 0.79 17%, 1.02 24%, 1.09 29%, 1.06 36%, 1 48%, 1);
  }
}

.tb-08 {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
}
/* Positional sibling state: which of four is checked. No Tailwind variant expresses this. */

.tb-08__group:has(label:nth-of-type(2) input:checked) .tb-08__thumb {
  translate: 100% 0;
}

.tb-08__group:has(label:nth-of-type(3) input:checked) .tb-08__thumb {
  translate: 200% 0;
}

.tb-08__group:has(label:nth-of-type(4) input:checked) .tb-08__thumb {
  translate: 300% 0;
}

@supports not selector(:has(*)) {
  .tb-08__thumb {
    display: none;
  }

  .tb-08 input:checked ~ span {
    color: var(--color-tb08-ink);
    text-decoration: underline;
    text-underline-offset: 0.4em;
  }
}

@media (prefers-color-scheme: dark) {
  .tb-08:not([data-theme="light"]) {
    --color-tb08-bg: oklch(0.12 0.006 280);
    --color-tb08-track: oklch(0.2 0.008 280);
    --color-tb08-thumb: oklch(0.32 0.012 280);
    --color-tb08-ink: oklch(0.97 0.003 280);
    --color-tb08-ink-soft: oklch(0.85 0.006 280);
    --color-tb08-muted: oklch(0.68 0.01 280);
    --color-tb08-accent: oklch(0.78 0.13 296);
  }
}

.tb-08[data-theme="dark"] {
  --color-tb08-bg: oklch(0.12 0.006 280);
  --color-tb08-track: oklch(0.2 0.008 280);
  --color-tb08-thumb: oklch(0.32 0.012 280);
  --color-tb08-ink: oklch(0.97 0.003 280);
  --color-tb08-muted: oklch(0.68 0.01 280);
}

@media (forced-colors: active) {
  .tb-08__group {
    border: 1px solid ButtonText;
  }

  .tb-08__thumb {
    background: Highlight;
  }

  .tb-08 label:has(input:checked) {
    color: HighlightText;
  }
}
```

How this works

The platform does the hard part. Each segment is a visually-hidden radio inside its label, so arrows move and select, and Tab enters and leaves the group as one stop. No JavaScript, no role="radiogroup" hand-rolling, no keydown handler.

Half the relational CSS becomes variants, half stays CSS. The per-label conditions port cleanly:

<label class="… text-tb08-muted has-checked:text-tb08-ink
  has-focus-visible:outline-2 has-focus-visible:outline-tb08-accent">

The thumb's position does not. It depends on which of four siblings is checked, and Tailwind has no positional sibling variant, so four :has() rules stay in the stylesheet — the one place in this demo where the CSS original is simply the better expression.

The @supports not selector(:has(*)) fallback survives untouched: no thumb, and the checked label gets an underline instead. Utilities cannot express a negative feature query, and should not try.

Make it yours

  • Change the segment count: edit the thumb's w-[calc(...)] divisor and add one :has() rule in the CSS block.
  • Tabs instead of a pill: give the thumb h-0.5 top-auto bottom-1 rounded-none.
  • Vertical filter list: flex-col on the group, and change the CSS translate steps to the Y axis.
  • Icon + label segments: put both inside the <span> — the thumb is fraction-sized, not content-sized.
  • Brand it through --color-tb08-thumb and --color-tb08-ink; inactive labels stay muted for hierarchy.

Gotchas — read before shipping

  • Never use hidden on the radio — it leaves the accessibility tree and stops being focusable. sr-only is the correct utility.
  • A segmented control is a radio group, not a row of buttons. Building it from <button>s means writing role="radiogroup", aria-checked and arrow keys yourself.
  • has-checked: matches any checked descendant. That is exactly right here (one input per label) and wrong the moment a label holds two.
  • Percentage translate resolves against the thumb's own width, so the thumb must be exactly 100%/n or the segments drift.
  • Give the group role="group" with an aria-label — a bare radio set has no announced purpose.

Browser support

ChromeSafariFirefoxEdge
111+16.4+128+111+

:has() (Chrome 105 / Safari 15.4 / Firefox 121) drives both the thumb and the has-* variants; the @supports not selector(:has(*)) block degrades to an underlined checked label. linear() easing needs Chrome 113 / Safari 17.2 / Firefox 112 and falls back to the declared cubic-bezier.

Techniques used in this demo

Utilitiesfirst-class utility or variant

Search CodeFronts

Loading…