# Feature tabs

> One panel, many features: the line slides between tabs, fills as autoplay runs, and the panel eases to each.

Feature tabs are where a landing page shows the product, and most snap from one screenshot to the next. Here the line under the chosen tab slides across with a little give; with autoplay it fills like a progress bar and hands over to the next tab when full, pausing whenever you point at it. The panel eases to the height of what it’s showing while the new content slides in from the side you went, through a light blur.

## Install

```bash
npx shadcn@latest add https://hairlineui.com/r/feature-tabs.json
```

Needs React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.

- npm: none
- Hairline UI components it needs (the CLI installs them too): none
- Docs and live preview: https://hairlineui.com/ui/feature-tabs
- Registry item (source): https://hairlineui.com/r/feature-tabs.json

## Usage

```tsx
import { FeatureTabs } from "@/components/feature-tabs";

<FeatureTabs
  autoplay={4200}
  tabs={[
    { id: "plan", label: "Plan", content: <PlanShot /> },
    { id: "ship", label: "Ship", content: <ShipShot /> },
  ]}
/>
```

## In a features section

Put whatever shows the feature best in each tab: a screenshot, a video, a small live mock.

```tsx
import Image from "next/image";
import { FeatureTabs } from "@/components/feature-tabs";

const features = [
  { id: "plan", label: "Plan", title: "Turn a rough idea into a plan", shot: "/shots/plan.png" },
  { id: "write", label: "Write", title: "Write it once, in your voice", shot: "/shots/write.png" },
  { id: "ship", label: "Ship", title: "Ship with a log you can read", shot: "/shots/ship.png" },
];

export function Features() {
  return (
    <section className="mx-auto max-w-4xl">
      <FeatureTabs
        autoplay={5000}
        tabs={features.map((f) => ({
          id: f.id,
          label: f.label,
          content: (
            <div className="grid items-center gap-8 md:grid-cols-2">
              <h3 className="text-2xl font-medium tracking-tight">{f.title}</h3>
              <Image src={f.shot} alt="" width={640} height={420} className="rounded-2xl border" />
            </div>
          ),
        }))}
      />
    </section>
  );
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `tabs` | `{ id; label; content }[]` | – | Each tab and what its panel shows. |
| `value / defaultValue / onValueChange` | `string / string / (id) => void` | – | The chosen tab, controlled or not. |
| `autoplay` | `number` | – | Move on every this many ms, with the line as the timer. Off with reduced motion. |

## States

- **switch**: The line slides and resizes to the tab (520ms, slight overshoot); the label colour follows.
- **panel**: Height eases over 460ms; old content slides and blurs out one way, new content in from the other.
- **autoplay**: The line fills over the interval and moves to the next tab when full. Pointer or focus inside pauses it; clicking a tab restarts it.

## What it handles

Feature tabs are where a landing page shows the product, and most snap from one screenshot to the next. This eases between tabs, and can play through them on its own without moving under someone who is reading.

- **A line that follows the tab**: The line under the chosen tab slides across with a little give, and the label colour follows.
- **Autoplay with a visible timer**: The line fills like a progress bar, then hands over to the next tab when it is full.
- **It pauses when you do**: Pointing at it, or focus inside, pauses autoplay. Clicking a tab restarts the timer.
- **The panel eases to each tab**: The height eases to the new content, which slides in from the side you went.
- **Any content in a panel**: A screenshot, a video, a small mock or anything else React can render.
- **Real tabs**: A proper tablist with arrow keys, Home and End. With reduced motion there is no autoplay.

## Replaces

a tabs library, an autoplay timer, a progress bar, panel height animation, pause on hover logic

## Where it fits

- **Feature sections**: One tab per feature, each with a screenshot, a video or a small live demo.
- **Product tours**: Autoplay through the product in the order you want it seen.
- **Solutions pages**: One tab per team, role or use case.
- **Docs landing pages**: Switch between platforms or languages on a quick-start page.

## Notes

- A real tablist with a labelled tabpanel; arrow keys, Home and End move between tabs and only the chosen tab is in the tab order.
- Autoplay pauses while the pointer or focus is anywhere inside, so it never moves under someone reading.
- The progress is a CSS animation, so nothing re-renders while it runs.
- With reduced motion there is no autoplay and content changes in place.

License: MIT (https://hairlineui.com/license#components)
