32 Tailwind CSS Tabs
22 / 32
Pure TailwindMIT licensed

Bauhaus Color Block Tabs in Tailwind CSS

Four primary tiles — red, yellow, black and cream — each marked with a Bauhaus primitive: circle, square, triangle, half-moon. The chosen tile rises 6px and drops a hard shadow; there's no shared highlight colour because the tile itself is the indicator.

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-22 group/tabs grid min-h-svh w-full place-items-center bg-ttb22-cream px-5 py-14 font-ttb22-sans text-ttb22-ink" aria-label="Bauhaus color block tabs demo">
  <div class="grid w-full max-w-xl justify-items-center gap-7">
    <div class="w-full">
      <div role="radiogroup" aria-label="Principle" class="grid grid-cols-2 gap-2 pb-1.5 sm:grid-cols-4">
        <label class="group/tab flex min-h-20 cursor-pointer flex-col items-start justify-between bg-ttb22-red p-3 text-ttb22-cream transition-[translate,box-shadow] duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:-translate-y-0.5 has-checked:-translate-y-1.5 has-checked:shadow-[0_6px_0_var(--color-ttb22-ink)] has-focus-visible:outline-2 has-focus-visible:outline-offset-3 has-focus-visible:outline-ttb22-ink motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb22" id="ttb22-r1" checked><svg aria-hidden="true" class="size-5 transition-[scale] duration-300 group-has-checked/tab:scale-125" viewBox="0 0 20 20"><circle cx="10" cy="10" r="9" fill="currentColor"/></svg><span class="text-xs font-bold tracking-[0.22em] uppercase">Form</span></label>
        <label class="group/tab flex min-h-20 cursor-pointer flex-col items-start justify-between bg-ttb22-yellow p-3 text-ttb22-ink transition-[translate,box-shadow] duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:-translate-y-0.5 has-checked:-translate-y-1.5 has-checked:shadow-[0_6px_0_var(--color-ttb22-ink)] has-focus-visible:outline-2 has-focus-visible:outline-offset-3 has-focus-visible:outline-ttb22-ink motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb22" id="ttb22-r2"><svg aria-hidden="true" class="size-5 transition-[rotate] duration-300 group-has-checked/tab:rotate-45" viewBox="0 0 20 20"><rect x="2" y="2" width="16" height="16" fill="currentColor"/></svg><span class="text-xs font-bold tracking-[0.22em] uppercase">Grid</span></label>
        <label class="group/tab flex min-h-20 cursor-pointer flex-col items-start justify-between bg-ttb22-ink p-3 text-ttb22-cream transition-[translate,box-shadow] duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:-translate-y-0.5 has-checked:-translate-y-1.5 has-checked:shadow-[0_6px_0_var(--color-ttb22-red)] has-focus-visible:outline-2 has-focus-visible:outline-offset-3 has-focus-visible:outline-ttb22-ink motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb22" id="ttb22-r3"><svg aria-hidden="true" class="size-5 transition-[rotate] duration-300 group-has-checked/tab:rotate-180" viewBox="0 0 20 20"><path d="M10 1.5 19 18.5H1z" fill="currentColor"/></svg><span class="text-xs font-bold tracking-[0.22em] uppercase">Type</span></label>
        <label class="group/tab flex min-h-20 cursor-pointer flex-col items-start justify-between bg-ttb22-cream p-3 text-ttb22-ink ring-[1.5px] ring-ttb22-ink ring-inset transition-[translate,box-shadow] duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:-translate-y-0.5 has-checked:-translate-y-1.5 has-checked:shadow-[0_6px_0_var(--color-ttb22-ink)] has-focus-visible:outline-2 has-focus-visible:outline-offset-3 has-focus-visible:outline-ttb22-ink motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb22" id="ttb22-r4"><svg aria-hidden="true" class="size-5 transition-[rotate] duration-300 group-has-checked/tab:-rotate-90" viewBox="0 0 20 20"><path d="M1 14a9 9 0 0 1 18 0z" fill="currentColor"/></svg><span class="text-xs font-bold tracking-[0.22em] uppercase">Hue</span></label>
      </div>
      <div class="pt-5 font-ttb22-serif text-[16px] text-ttb22-ash italic">
        <p class="hidden group-has-[#ttb22-r1:checked]/tabs:block">Composition, weight and balance.</p>
        <p class="hidden group-has-[#ttb22-r2:checked]/tabs:block">Modular columns and rows.</p>
        <p class="hidden group-has-[#ttb22-r3:checked]/tabs:block">Specimens and pairings.</p>
        <p class="hidden group-has-[#ttb22-r4:checked]/tabs:block">A limited primary palette.</p>
      </div>
    </div>
    <p aria-hidden="true" class="border-[1.5px] border-ttb22-ink px-3.5 py-2 font-ttb22-mono text-[11.5px]">has-checked:-translate-y-1.5 · shadow-[0_6px_0] · primitives</p>
  </div>
</section>
@import "tailwindcss";

@theme {
  --color-ttb22-cream: #f5ead0;
  --color-ttb22-cream: oklch(0.939 0.036 87.8);
  --color-ttb22-red: #c43a32;
  --color-ttb22-red: oklch(0.552 0.176 27.7);
  --color-ttb22-yellow: #e0aa1c;
  --color-ttb22-yellow: oklch(0.768 0.152 84.5);
  --color-ttb22-ink: #1a1a1a;
  --color-ttb22-ink: oklch(0.218 0 0);
  --color-ttb22-ash: #3a3a42;
  --color-ttb22-ash: oklch(0.352 0.014 285.7);
  --font-ttb22-sans: 'Space Grotesk', system-ui, sans-serif;
  --font-ttb22-serif: 'Newsreader', Georgia, serif;
  --font-ttb22-mono: 'JetBrains 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-22 {
  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-ttb22-cream: #f5ead0;
  --color-ttb22-cream: oklch(0.939 0.036 87.8);
  --color-ttb22-red: #c43a32;
  --color-ttb22-red: oklch(0.552 0.176 27.7);
  --color-ttb22-yellow: #e0aa1c;
  --color-ttb22-yellow: oklch(0.768 0.152 84.5);
  --color-ttb22-ink: #1a1a1a;
  --color-ttb22-ink: oklch(0.218 0 0);
  --color-ttb22-ash: #3a3a42;
  --color-ttb22-ash: oklch(0.352 0.014 285.7);
  --font-ttb22-sans: 'Space Grotesk', system-ui, sans-serif;
  --font-ttb22-serif: 'Newsreader', Georgia, serif;
  --font-ttb22-mono: 'JetBrains 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-22 {
  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=Space+Grotesk:wght@500..700&family=Newsreader:ital,opsz,wght@1,6..72,400..600&family=JetBrains+Mono:wght@400;500&display=swap">

What changed in the port

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

  • input:checked + .tt10b lift and shadow became has-checked:-translate-y-1.5 has-checked:shadow-[0_6px_0_…].
  • The cream tile's combined inset … , 0 6px 0 shadow (repeated in two rules) became a ring plus the shared shadow utility — one place to edit each.
  • UI upgrade from the CSS original: each tile carries a Bauhaus primitive (circle, square, triangle, half-moon) that turns or grows when chosen; tiles are 80px tall and wrap to 2×2 on phones.
  • UI upgrade: the black tile drops a red shadow instead of an invisible black-on-black one, and keyboard focus is now visible.
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: Bauhaus Color Block Tabs in Tailwind CSS
Source: https://codefronts.com/navigation/tailwind-css-tabs/bauhaus-color-block-tabs-tailwind-css/

Four primary tiles — red, yellow, black and cream — each marked with a Bauhaus primitive: circle, square, triangle, half-moon. The chosen tile rises 6px and drops a hard shadow; there's no shared highlight colour because the tile itself is the indicator.
## HTML
```html
<section class="ttb-22 group/tabs grid min-h-svh w-full place-items-center bg-ttb22-cream px-5 py-14 font-ttb22-sans text-ttb22-ink" aria-label="Bauhaus color block tabs demo">
  <div class="grid w-full max-w-xl justify-items-center gap-7">
    <div class="w-full">
      <div role="radiogroup" aria-label="Principle" class="grid grid-cols-2 gap-2 pb-1.5 sm:grid-cols-4">
        <label class="group/tab flex min-h-20 cursor-pointer flex-col items-start justify-between bg-ttb22-red p-3 text-ttb22-cream transition-[translate,box-shadow] duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:-translate-y-0.5 has-checked:-translate-y-1.5 has-checked:shadow-[0_6px_0_var(--color-ttb22-ink)] has-focus-visible:outline-2 has-focus-visible:outline-offset-3 has-focus-visible:outline-ttb22-ink motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb22" id="ttb22-r1" checked><svg aria-hidden="true" class="size-5 transition-[scale] duration-300 group-has-checked/tab:scale-125" viewBox="0 0 20 20"><circle cx="10" cy="10" r="9" fill="currentColor"/></svg><span class="text-xs font-bold tracking-[0.22em] uppercase">Form</span></label>
        <label class="group/tab flex min-h-20 cursor-pointer flex-col items-start justify-between bg-ttb22-yellow p-3 text-ttb22-ink transition-[translate,box-shadow] duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:-translate-y-0.5 has-checked:-translate-y-1.5 has-checked:shadow-[0_6px_0_var(--color-ttb22-ink)] has-focus-visible:outline-2 has-focus-visible:outline-offset-3 has-focus-visible:outline-ttb22-ink motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb22" id="ttb22-r2"><svg aria-hidden="true" class="size-5 transition-[rotate] duration-300 group-has-checked/tab:rotate-45" viewBox="0 0 20 20"><rect x="2" y="2" width="16" height="16" fill="currentColor"/></svg><span class="text-xs font-bold tracking-[0.22em] uppercase">Grid</span></label>
        <label class="group/tab flex min-h-20 cursor-pointer flex-col items-start justify-between bg-ttb22-ink p-3 text-ttb22-cream transition-[translate,box-shadow] duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:-translate-y-0.5 has-checked:-translate-y-1.5 has-checked:shadow-[0_6px_0_var(--color-ttb22-red)] has-focus-visible:outline-2 has-focus-visible:outline-offset-3 has-focus-visible:outline-ttb22-ink motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb22" id="ttb22-r3"><svg aria-hidden="true" class="size-5 transition-[rotate] duration-300 group-has-checked/tab:rotate-180" viewBox="0 0 20 20"><path d="M10 1.5 19 18.5H1z" fill="currentColor"/></svg><span class="text-xs font-bold tracking-[0.22em] uppercase">Type</span></label>
        <label class="group/tab flex min-h-20 cursor-pointer flex-col items-start justify-between bg-ttb22-cream p-3 text-ttb22-ink ring-[1.5px] ring-ttb22-ink ring-inset transition-[translate,box-shadow] duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:-translate-y-0.5 has-checked:-translate-y-1.5 has-checked:shadow-[0_6px_0_var(--color-ttb22-ink)] has-focus-visible:outline-2 has-focus-visible:outline-offset-3 has-focus-visible:outline-ttb22-ink motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb22" id="ttb22-r4"><svg aria-hidden="true" class="size-5 transition-[rotate] duration-300 group-has-checked/tab:-rotate-90" viewBox="0 0 20 20"><path d="M1 14a9 9 0 0 1 18 0z" fill="currentColor"/></svg><span class="text-xs font-bold tracking-[0.22em] uppercase">Hue</span></label>
      </div>
      <div class="pt-5 font-ttb22-serif text-[16px] text-ttb22-ash italic">
        <p class="hidden group-has-[#ttb22-r1:checked]/tabs:block">Composition, weight and balance.</p>
        <p class="hidden group-has-[#ttb22-r2:checked]/tabs:block">Modular columns and rows.</p>
        <p class="hidden group-has-[#ttb22-r3:checked]/tabs:block">Specimens and pairings.</p>
        <p class="hidden group-has-[#ttb22-r4:checked]/tabs:block">A limited primary palette.</p>
      </div>
    </div>
    <p aria-hidden="true" class="border-[1.5px] border-ttb22-ink px-3.5 py-2 font-ttb22-mono text-[11.5px]">has-checked:-translate-y-1.5 · shadow-[0_6px_0] · primitives</p>
  </div>
</section>
```
## CSS
```css
@import "tailwindcss";

@theme {
  --color-ttb22-cream: #f5ead0;
  --color-ttb22-cream: oklch(0.939 0.036 87.8);
  --color-ttb22-red: #c43a32;
  --color-ttb22-red: oklch(0.552 0.176 27.7);
  --color-ttb22-yellow: #e0aa1c;
  --color-ttb22-yellow: oklch(0.768 0.152 84.5);
  --color-ttb22-ink: #1a1a1a;
  --color-ttb22-ink: oklch(0.218 0 0);
  --color-ttb22-ash: #3a3a42;
  --color-ttb22-ash: oklch(0.352 0.014 285.7);
  --font-ttb22-sans: 'Space Grotesk', system-ui, sans-serif;
  --font-ttb22-serif: 'Newsreader', Georgia, serif;
  --font-ttb22-mono: 'JetBrains 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-22 {
  width: 100%;
  min-height: 100svh;
}
```

How this works

The shadow is where the tile was. A 6px lift and a 6px zero-blur shadow move together; change one and you must change the other:

has-checked:-translate-y-1.5 has-checked:shadow-[0_6px_0_var(--color-ttb22-ink)]

The cream tile keeps its inset ring when lifted because the ring is a separate ring utility, not part of the shadow stack the original had to repeat in two rules.

Make it yours

  • Your own primaries: keep three heavy tiles and one paper tile.
  • Stricter Swiss: replace the overshoot ease with ease-out.
  • Drop the shapes for text-only tiles.

Gotchas — read before shipping

  • Each tile needs its own text colour for contrast — yellow takes ink, red takes cream.
  • Lifted tiles need bottom padding on the row or the shadow clips.
  • Shapes are aria-hidden; the word names the tab.

Browser support

ChromeSafariFirefoxEdge
111+16.4+128+111+

:has() for panels; everything else is universal.

Techniques used in this demo

Utilitiesfirst-class utility or variant

Search CodeFronts

Loading…