Skip to content

Underlined tabs in React

Understated tabs with an underlined active tab, to organize the information on a product page.

Here is an excerpt of this component's code in React. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in React

UnderlineTabs.tsx
import { useId, useRef, useState, type KeyboardEvent, type ReactNode } from "react";

const tabs: { label: ReactNode; content: ReactNode }[] = [
  {
    label: <>Description</>,
    content: (
      <>
        <p>
          Sac cabas en toile de coton biologique épaisse (420 g/m²), anses en cuir tanné végétal et
          poche intérieure zippée. Fabriqué dans notre atelier de Roanne.
        </p>
      </>

Free component: copy it freely, including for commercial projects.

Tabs components in React
  • Accessible tabs on large screens that turn into an accordion on phones, with the right ARIA roles in each mode.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Indicative prices sorted by trade in tabs, with the unit of each service, a VAT-inclusive / excl. switch and a free-quote notice.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Two tabs to show different opening hours by season, in a compact card.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A dark code block with one tab per package manager, for technical documentation.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component