32 Tailwind CSS Tabs
16 / 32
Pure TailwindMIT licensed

Tailwind Bottom Navigation Bar with Expanding Labels

A mobile nav bar in a soft white pill. The chosen item grows (flex-1 → flex-[2.6]), a pink halo blooms behind its icon and the label slides out beside it. The port fixes the original's unreadable mint label (1.9:1 on white) with a deep-teal label token while the icon keeps the bright mint.

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-16 grid min-h-svh w-full place-items-center bg-ttb16-bg px-4 py-14 font-ttb16-sans text-ttb16-ink" aria-label="Bottom navigation bar with expanding labels demo">
  <div class="grid w-full max-w-md justify-items-center gap-8">
    <div role="radiogroup" aria-label="App navigation" class="flex w-full gap-1 rounded-full bg-white p-2 shadow-[0_10px_30px_-10px_rgb(0_0_0/0.18)]">
      <label class="group/tab relative flex min-h-12 flex-1 cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-full text-ttb16-idle transition-[flex-grow,color] duration-450 ease-[cubic-bezier(0.4,0,0.2,1)] hover:text-ttb16-hover has-checked:flex-[2.6] has-focus-visible:outline-2 has-focus-visible:-outline-offset-2 has-focus-visible:outline-ttb16-label motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb16" id="ttb16-r1" checked><span class="relative grid flex-none place-items-center"><span aria-hidden="true" class="absolute -top-1 -left-1 size-6 scale-0 rounded-full bg-ttb16-halo transition-transform duration-450 group-has-checked/tab:scale-100"></span><svg aria-hidden="true" class="relative size-6 transition-colors group-has-checked/tab:text-ttb16-mint" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M3 11l9-8 9 8M5 9.5V20h5v-6h4v6h5V9.5"/></svg></span><span class="max-w-0 -translate-x-2 overflow-hidden text-[15px] font-extrabold whitespace-nowrap text-ttb16-label opacity-0 transition-[max-width,opacity,translate] delay-100 duration-450 group-has-checked/tab:max-w-32 group-has-checked/tab:translate-x-0 group-has-checked/tab:opacity-100 motion-reduce:transition-none">Home</span></label>
      <label class="group/tab relative flex min-h-12 flex-1 cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-full text-ttb16-idle transition-[flex-grow,color] duration-450 ease-[cubic-bezier(0.4,0,0.2,1)] hover:text-ttb16-hover has-checked:flex-[2.6] has-focus-visible:outline-2 has-focus-visible:-outline-offset-2 has-focus-visible:outline-ttb16-label motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb16" id="ttb16-r2"><span class="relative grid flex-none place-items-center"><span aria-hidden="true" class="absolute -top-1 -left-1 size-6 scale-0 rounded-full bg-ttb16-halo transition-transform duration-450 group-has-checked/tab:scale-100"></span><svg aria-hidden="true" class="relative size-6 transition-colors group-has-checked/tab:text-ttb16-mint" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M5 8l7-5 7 5v3H5zM9 11h6v8H9zM3 20h18"/></svg></span><span class="max-w-0 -translate-x-2 overflow-hidden text-[15px] font-extrabold whitespace-nowrap text-ttb16-label opacity-0 transition-[max-width,opacity,translate] delay-100 duration-450 group-has-checked/tab:max-w-32 group-has-checked/tab:translate-x-0 group-has-checked/tab:opacity-100 motion-reduce:transition-none">Strategy</span></label>
      <label class="group/tab relative flex min-h-12 flex-1 cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-full text-ttb16-idle transition-[flex-grow,color] duration-450 ease-[cubic-bezier(0.4,0,0.2,1)] hover:text-ttb16-hover has-checked:flex-[2.6] has-focus-visible:outline-2 has-focus-visible:-outline-offset-2 has-focus-visible:outline-ttb16-label motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb16" id="ttb16-r3"><span class="relative grid flex-none place-items-center"><span aria-hidden="true" class="absolute -top-1 -left-1 size-6 scale-0 rounded-full bg-ttb16-halo transition-transform duration-450 group-has-checked/tab:scale-100"></span><svg aria-hidden="true" class="relative size-6 transition-colors group-has-checked/tab:text-ttb16-mint" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M7 3h10v4l-3 5 3 5v4H7v-4l3-5-3-5z"/></svg></span><span class="max-w-0 -translate-x-2 overflow-hidden text-[15px] font-extrabold whitespace-nowrap text-ttb16-label opacity-0 transition-[max-width,opacity,translate] delay-100 duration-450 group-has-checked/tab:max-w-32 group-has-checked/tab:translate-x-0 group-has-checked/tab:opacity-100 motion-reduce:transition-none">Period</span></label>
      <label class="group/tab relative flex min-h-12 flex-1 cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-full text-ttb16-idle transition-[flex-grow,color] duration-450 ease-[cubic-bezier(0.4,0,0.2,1)] hover:text-ttb16-hover has-checked:flex-[2.6] has-focus-visible:outline-2 has-focus-visible:-outline-offset-2 has-focus-visible:outline-ttb16-label motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb16" id="ttb16-r4"><span class="relative grid flex-none place-items-center"><span aria-hidden="true" class="absolute -top-1 -left-1 size-6 scale-0 rounded-full bg-ttb16-halo transition-transform duration-450 group-has-checked/tab:scale-100"></span><svg aria-hidden="true" class="relative size-6 transition-colors group-has-checked/tab:text-ttb16-mint" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2L4 6v6c0 5 3.5 9.5 8 10 4.5-.5 8-5 8-10V6zM9 12l2 2 4-4"/></svg></span><span class="max-w-0 -translate-x-2 overflow-hidden text-[15px] font-extrabold whitespace-nowrap text-ttb16-label opacity-0 transition-[max-width,opacity,translate] delay-100 duration-450 group-has-checked/tab:max-w-32 group-has-checked/tab:translate-x-0 group-has-checked/tab:opacity-100 motion-reduce:transition-none">Security</span></label>
    </div>
    <p aria-hidden="true" class="rounded-full bg-white/70 px-3.5 py-2 font-ttb16-mono text-[11.5px] text-ttb16-mut">has-checked:flex-[2.6] · halo scale-0 → 100 · label max-w slide</p>
  </div>
</section>
@import "tailwindcss";

@theme {
  --color-ttb16-bg: #eef0f0;
  --color-ttb16-bg: oklch(0.954 0.002 197.1);
  --color-ttb16-ink: #1f2a2a;
  --color-ttb16-ink: oklch(0.275 0.015 196.3);
  --color-ttb16-idle: #8b949a;
  --color-ttb16-idle: oklch(0.661 0.014 236.7);
  --color-ttb16-hover: #6d777c;
  --color-ttb16-hover: oklch(0.563 0.014 229.1);
  --color-ttb16-mint: #2dd4bf;
  --color-ttb16-mint: oklch(0.785 0.133 181.9);
  --color-ttb16-label: #0f766e;
  --color-ttb16-label: oklch(0.511 0.086 186.4);
  --color-ttb16-halo: #fde4ec;
  --color-ttb16-halo: oklch(0.941 0.029 356.3);
  --color-ttb16-mut: #5d686d;
  --color-ttb16-mut: oklch(0.510 0.016 226.8);
  --font-ttb16-sans: 'Nunito', system-ui, sans-serif;
  --font-ttb16-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-16 {
  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-ttb16-bg: #eef0f0;
  --color-ttb16-bg: oklch(0.954 0.002 197.1);
  --color-ttb16-ink: #1f2a2a;
  --color-ttb16-ink: oklch(0.275 0.015 196.3);
  --color-ttb16-idle: #8b949a;
  --color-ttb16-idle: oklch(0.661 0.014 236.7);
  --color-ttb16-hover: #6d777c;
  --color-ttb16-hover: oklch(0.563 0.014 229.1);
  --color-ttb16-mint: #2dd4bf;
  --color-ttb16-mint: oklch(0.785 0.133 181.9);
  --color-ttb16-label: #0f766e;
  --color-ttb16-label: oklch(0.511 0.086 186.4);
  --color-ttb16-halo: #fde4ec;
  --color-ttb16-halo: oklch(0.941 0.029 356.3);
  --color-ttb16-mut: #5d686d;
  --color-ttb16-mut: oklch(0.510 0.016 226.8);
  --font-ttb16-sans: 'Nunito', system-ui, sans-serif;
  --font-ttb16-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-16 {
  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=Nunito:wght@600;700;800&family=JetBrains+Mono:wght@400;500&display=swap">

What changed in the port

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

  • input:checked + .tt04b { flex: 2.6 } became has-checked:flex-[2.6]; the halo and label rules became group-has-checked/tab: utilities on the children.
  • The hard-coded halo offsets (top:14%; left:22%) were replaced by a halo positioned against the icon's own wrapper, so it stays on the glyph at any width.
  • UI upgrade from the CSS original: the label is now deep teal #0f766e (5.5:1 on white) instead of mint (1.9:1); the icon keeps the bright mint so the brand colour survives.
  • UI upgrade: a visible keyboard focus ring (the original had none), and resting icons darkened to 3.1:1 (the WCAG graphical-object minimum) from 2.2:1.
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 Bottom Navigation Bar with Expanding Labels
Source: https://codefronts.com/navigation/tailwind-css-tabs/tailwind-bottom-navigation-bar-expanding-labels/

A mobile nav bar in a soft white pill. The chosen item grows (flex-1 → flex-[2.6]), a pink halo blooms behind its icon and the label slides out beside it. The port fixes the original's unreadable mint label (1.9:1 on white) with a deep-teal label token while the icon keeps the bright mint.
## HTML
```html
<section class="ttb-16 grid min-h-svh w-full place-items-center bg-ttb16-bg px-4 py-14 font-ttb16-sans text-ttb16-ink" aria-label="Bottom navigation bar with expanding labels demo">
  <div class="grid w-full max-w-md justify-items-center gap-8">
    <div role="radiogroup" aria-label="App navigation" class="flex w-full gap-1 rounded-full bg-white p-2 shadow-[0_10px_30px_-10px_rgb(0_0_0/0.18)]">
      <label class="group/tab relative flex min-h-12 flex-1 cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-full text-ttb16-idle transition-[flex-grow,color] duration-450 ease-[cubic-bezier(0.4,0,0.2,1)] hover:text-ttb16-hover has-checked:flex-[2.6] has-focus-visible:outline-2 has-focus-visible:-outline-offset-2 has-focus-visible:outline-ttb16-label motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb16" id="ttb16-r1" checked><span class="relative grid flex-none place-items-center"><span aria-hidden="true" class="absolute -top-1 -left-1 size-6 scale-0 rounded-full bg-ttb16-halo transition-transform duration-450 group-has-checked/tab:scale-100"></span><svg aria-hidden="true" class="relative size-6 transition-colors group-has-checked/tab:text-ttb16-mint" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M3 11l9-8 9 8M5 9.5V20h5v-6h4v6h5V9.5"/></svg></span><span class="max-w-0 -translate-x-2 overflow-hidden text-[15px] font-extrabold whitespace-nowrap text-ttb16-label opacity-0 transition-[max-width,opacity,translate] delay-100 duration-450 group-has-checked/tab:max-w-32 group-has-checked/tab:translate-x-0 group-has-checked/tab:opacity-100 motion-reduce:transition-none">Home</span></label>
      <label class="group/tab relative flex min-h-12 flex-1 cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-full text-ttb16-idle transition-[flex-grow,color] duration-450 ease-[cubic-bezier(0.4,0,0.2,1)] hover:text-ttb16-hover has-checked:flex-[2.6] has-focus-visible:outline-2 has-focus-visible:-outline-offset-2 has-focus-visible:outline-ttb16-label motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb16" id="ttb16-r2"><span class="relative grid flex-none place-items-center"><span aria-hidden="true" class="absolute -top-1 -left-1 size-6 scale-0 rounded-full bg-ttb16-halo transition-transform duration-450 group-has-checked/tab:scale-100"></span><svg aria-hidden="true" class="relative size-6 transition-colors group-has-checked/tab:text-ttb16-mint" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M5 8l7-5 7 5v3H5zM9 11h6v8H9zM3 20h18"/></svg></span><span class="max-w-0 -translate-x-2 overflow-hidden text-[15px] font-extrabold whitespace-nowrap text-ttb16-label opacity-0 transition-[max-width,opacity,translate] delay-100 duration-450 group-has-checked/tab:max-w-32 group-has-checked/tab:translate-x-0 group-has-checked/tab:opacity-100 motion-reduce:transition-none">Strategy</span></label>
      <label class="group/tab relative flex min-h-12 flex-1 cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-full text-ttb16-idle transition-[flex-grow,color] duration-450 ease-[cubic-bezier(0.4,0,0.2,1)] hover:text-ttb16-hover has-checked:flex-[2.6] has-focus-visible:outline-2 has-focus-visible:-outline-offset-2 has-focus-visible:outline-ttb16-label motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb16" id="ttb16-r3"><span class="relative grid flex-none place-items-center"><span aria-hidden="true" class="absolute -top-1 -left-1 size-6 scale-0 rounded-full bg-ttb16-halo transition-transform duration-450 group-has-checked/tab:scale-100"></span><svg aria-hidden="true" class="relative size-6 transition-colors group-has-checked/tab:text-ttb16-mint" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M7 3h10v4l-3 5 3 5v4H7v-4l3-5-3-5z"/></svg></span><span class="max-w-0 -translate-x-2 overflow-hidden text-[15px] font-extrabold whitespace-nowrap text-ttb16-label opacity-0 transition-[max-width,opacity,translate] delay-100 duration-450 group-has-checked/tab:max-w-32 group-has-checked/tab:translate-x-0 group-has-checked/tab:opacity-100 motion-reduce:transition-none">Period</span></label>
      <label class="group/tab relative flex min-h-12 flex-1 cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-full text-ttb16-idle transition-[flex-grow,color] duration-450 ease-[cubic-bezier(0.4,0,0.2,1)] hover:text-ttb16-hover has-checked:flex-[2.6] has-focus-visible:outline-2 has-focus-visible:-outline-offset-2 has-focus-visible:outline-ttb16-label motion-reduce:transition-none"><input class="sr-only" type="radio" name="ttb16" id="ttb16-r4"><span class="relative grid flex-none place-items-center"><span aria-hidden="true" class="absolute -top-1 -left-1 size-6 scale-0 rounded-full bg-ttb16-halo transition-transform duration-450 group-has-checked/tab:scale-100"></span><svg aria-hidden="true" class="relative size-6 transition-colors group-has-checked/tab:text-ttb16-mint" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2L4 6v6c0 5 3.5 9.5 8 10 4.5-.5 8-5 8-10V6zM9 12l2 2 4-4"/></svg></span><span class="max-w-0 -translate-x-2 overflow-hidden text-[15px] font-extrabold whitespace-nowrap text-ttb16-label opacity-0 transition-[max-width,opacity,translate] delay-100 duration-450 group-has-checked/tab:max-w-32 group-has-checked/tab:translate-x-0 group-has-checked/tab:opacity-100 motion-reduce:transition-none">Security</span></label>
    </div>
    <p aria-hidden="true" class="rounded-full bg-white/70 px-3.5 py-2 font-ttb16-mono text-[11.5px] text-ttb16-mut">has-checked:flex-[2.6] · halo scale-0 → 100 · label max-w slide</p>
  </div>
</section>
```
## CSS
```css
@import "tailwindcss";

@theme {
  --color-ttb16-bg: #eef0f0;
  --color-ttb16-bg: oklch(0.954 0.002 197.1);
  --color-ttb16-ink: #1f2a2a;
  --color-ttb16-ink: oklch(0.275 0.015 196.3);
  --color-ttb16-idle: #8b949a;
  --color-ttb16-idle: oklch(0.661 0.014 236.7);
  --color-ttb16-hover: #6d777c;
  --color-ttb16-hover: oklch(0.563 0.014 229.1);
  --color-ttb16-mint: #2dd4bf;
  --color-ttb16-mint: oklch(0.785 0.133 181.9);
  --color-ttb16-label: #0f766e;
  --color-ttb16-label: oklch(0.511 0.086 186.4);
  --color-ttb16-halo: #fde4ec;
  --color-ttb16-halo: oklch(0.941 0.029 356.3);
  --color-ttb16-mut: #5d686d;
  --color-ttb16-mut: oklch(0.510 0.016 226.8);
  --font-ttb16-sans: 'Nunito', system-ui, sans-serif;
  --font-ttb16-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-16 {
  width: 100%;
  min-height: 100svh;
}
```

How this works

Three motions on one curve. Item growth, halo and label share cubic-bezier(0.4,0,0.2,1), so the reveal arrives as one gesture:

<label class="flex-1 transition-[flex-grow] has-checked:flex-[2.6]">
  <span class="scale-0 bg-ttb16-halo group-has-checked/tab:scale-100"></span>
  <svg class="text-ttb16-mint">…</svg>
  <span class="max-w-0 opacity-0 group-has-checked/tab:max-w-32 group-has-checked/tab:opacity-100">Home</span>

The label waits 100ms before fading in, so it appears after the item has started to widen.

Make it yours

  • Fix it to the viewport: wrap in fixed inset-x-4 bottom-4 and add pb-[env(safe-area-inset-bottom)].
  • Brand pair: swap mint and halo tokens; keep a dark label token for contrast.
  • Four items: delete one label; the flex maths adapts.

Gotchas — read before shipping

  • flex-grow transitions are layout work; one bar is fine.
  • On 320px screens with five items, keep labels short or reduce flex-[2.6] to flex-[2].
  • Icons are aria-hidden; the collapsed label is still the accessible name.

Browser support

ChromeSafariFirefoxEdge
111+16.4+128+111+

flex-grow interpolation is universal; the floor is Tailwind v4's sheet.

Techniques used in this demo

Utilitiesfirst-class utility or variant

Search CodeFronts

Loading…