Web InnoventixFreeCode

Underline Tabs

MIT · attributed

An accessible underline-style tab switcher with a bottom-border active indicator and a live content panel. State-driven with proper role=tablist/tab/tabpanel and aria-selected wiring, styled for light and dark modes.

byMark MeadReact + Tailwind
tabsunderline-tabstabbed-contenttab-navigationcontent-switcher
Open

Copy prompt gives Claude Code, Cursor or v0 a ready-to-paste prompt that recreates this exact component.

npx shadcn@latest add https://webinnoventix.com/r/src-underline-tabs.json
src-underline-tabs.tsx
/* Source: Mark Mead (HyperUI) — https://github.com/markmead/hyperui/blob/main/public/examples/application/tabs/4.html — MIT. Included under its original licence. */
/* Copyright (c) Mark Mead — HyperUI (https://www.hyperui.dev). Licensed under the MIT License. */
"use client";

import { useState } from "react";

const TABS = [
  {
    label: "Overview",
    body: "A high-level snapshot of your workspace. Track active projects, recent activity and the metrics that matter most, all from a single unified view.",
  },
  {
    label: "Analytics",
    body: "Dig into trends over time with cohort breakdowns, conversion funnels and retention curves. Filter by segment to find where growth is really coming from.",
  },
  {
    label: "Reports",
    body: "Generate shareable summaries on any schedule. Export to PDF or CSV and send them straight to your team so everyone stays aligned on the numbers.",
  },
];

export default function SrUnderlineTabs() {
  const [active, setActive] = useState(0);

  return (
    <div className="mx-auto max-w-3xl p-6">
      <div role="tablist" aria-label="Sections" className="flex gap-2 border-b border-gray-200 dark:border-gray-700">
        {TABS.map((tab, index) => {
          const selected = index === active;
          return (
            <button
              key={tab.label}
              role="tab"
              type="button"
              aria-selected={selected}
              aria-controls={`tabpanel-${index}`}
              id={`tab-${index}`}
              onClick={() => setActive(index)}
              className={
                selected
                  ? "-mb-px border-b-2 border-blue-600 px-4 py-2 text-sm font-medium text-blue-600 transition-colors hover:text-blue-700 dark:hover:text-blue-500"
                  : "-mb-px border-b-2 border-transparent px-4 py-2 text-sm font-medium text-gray-600 transition-colors hover:text-gray-700 dark:text-gray-300 dark:hover:text-gray-200"
              }
            >
              {tab.label}
            </button>
          );
        })}
      </div>

      <div
        role="tabpanel"
        id={`tabpanel-${active}`}
        aria-labelledby={`tab-${active}`}
        className="mt-4"
      >
        <p className="text-gray-700 dark:text-gray-200">{TABS[active].body}</p>
      </div>
    </div>
  );
}

Dependencies

None — React + Tailwind only.

Licence

Mark Mead (original) · Licensed under MIT.

Built by Web Innoventix

Need a custom interface, a full website, or SEO that gets you cited by AI? We design, build and rank it end to end.

Get a free quote

Similar components

Browse all →
Centred Logo Navbar

Centred Logo Navbar

Original

A three-column navbar with the brand logo centred between the primary links and the account actions, wrapped in a soft rounded card.

Left Logo Navbar With CTA

Left Logo Navbar With CTA

Original

A classic left-aligned logo navbar with centred navigation links and a prominent pill call-to-action button on the right.

Navbar With Dropdown Menu

Navbar With Dropdown Menu

Original

A navbar featuring a JS-free product dropdown built with native details and summary, revealing a two-item mega-menu panel with icons.

Glass Transparent Navbar

Glass Transparent Navbar

Original

A frosted glass navbar floating over a colourful gradient hero backdrop, using backdrop blur and translucent borders for a modern overlay header.

Responsive Navbar with Mobile Menu

Responsive Navbar with Mobile Menu

MIT

A marketing site header with a logo, inline nav links, login/register buttons, and a working hamburger toggle that reveals a stacked mobile menu below the md breakpoint. Fully keyboard/ARIA accessible with light and dark variants.

Split Button Dropdown Menu

Split Button Dropdown Menu

MIT

A split-button control with a chevron trigger that opens a divided action menu, including a destructive delete item. Closes on outside-click and Escape, with a rotating chevron and full ARIA menu roles for both light and dark themes.

Spotlight Hero

Spotlight Hero

Original

A centred hero with a soft radial spotlight, badge and dual call-to-action.

Split Hero

Split Hero

Original

A two-column hero pairing a headline and CTAs with a product mock and social proof.

Gradient Spotlight Hero

Gradient Spotlight Hero

Original

A minimal centred hero with a soft gradient-mesh backdrop, announcement pill and dual call-to-action buttons.

App Preview Hero

App Preview Hero

Original

A centred hero that pairs headline copy with a realistic product dashboard mock built entirely from markup, complete with browser chrome and a floating notification card.

Waitlist Capture Hero

Waitlist Capture Hero

Original

A dark, focused hero with an inline email capture form and avatar social proof, ready for pre-launch waitlists.

Image Backdrop Hero

Image Backdrop Hero

Original

A cinematic full-bleed hero with a layered image-style backdrop, overlaid left-aligned copy and a trusted-by logos strip.