# Animated Tabs

> Tabs whose active indicator springs between triggers as a raised pill or an underline.

Source: https://www.honestui.com/docs/animated/animated-tabs

```tsx
"use client";

import {
  AnimatedTabs,
  AnimatedTabsList,
  AnimatedTabsPanel,
  AnimatedTabsTab,
} from "@/registry/default/animated/animated-tabs";

const tabs = [
  { value: "overview", label: "Overview", body: "Traffic is up 12% this week, led by returning visitors from search." },
  { value: "analytics", label: "Analytics", body: "Median session length is 4m 12s. Most sessions start on the pricing page." },
  { value: "reports", label: "Reports", body: "Three scheduled reports run every Monday at 9:00 AM." },
  { value: "settings", label: "Settings", body: "Data is retained for 13 months. Exports are available as CSV." },
];

export function AnimatedTabsDemo() {
  return (
    <div className="flex w-full max-w-md flex-col gap-10">
      <AnimatedTabs defaultValue="overview">
        <AnimatedTabsList aria-label="Dashboard sections">
          {tabs.map((tab) => (
            <AnimatedTabsTab key={tab.value} value={tab.value}>
              {tab.label}
            </AnimatedTabsTab>
          ))}
        </AnimatedTabsList>
        {tabs.map((tab) => (
          <AnimatedTabsPanel key={tab.value} value={tab.value}>
            <p className="text-sm leading-relaxed text-muted-foreground">{tab.body}</p>
          </AnimatedTabsPanel>
        ))}
      </AnimatedTabs>
      <AnimatedTabs defaultValue="analytics">
        <AnimatedTabsList variant="underline" aria-label="Dashboard sections, underline style">
          {tabs.map((tab) => (
            <AnimatedTabsTab key={tab.value} value={tab.value}>
              {tab.label}
            </AnimatedTabsTab>
          ))}
        </AnimatedTabsList>
      </AnimatedTabs>
    </div>
  );
}

```

## Overview [#overview]

Animated Tabs pairs Base UI Tabs with a shared-layout indicator. The indicator lives inside the active tab and carries one layout id per list, so it springs to the next tab whether the change comes from a click, a tap, or the keyboard. Panel content fades in when its tab becomes active. Use the `pill` variant for compact segmented controls and `underline` for section navigation.

## Installation [#installation]

<CliBlock commands="[&#x22;animated-tabs&#x22;]" />

## Usage [#usage]

```tsx
import {
  AnimatedTabs,
  AnimatedTabsList,
  AnimatedTabsPanel,
  AnimatedTabsTab,
} from "@/components/animated/animated-tabs"

<AnimatedTabs defaultValue="overview">
  <AnimatedTabsList aria-label="Dashboard sections">
    <AnimatedTabsTab value="overview">Overview</AnimatedTabsTab>
    <AnimatedTabsTab value="analytics">Analytics</AnimatedTabsTab>
  </AnimatedTabsList>
  <AnimatedTabsPanel value="overview">…</AnimatedTabsPanel>
  <AnimatedTabsPanel value="analytics">…</AnimatedTabsPanel>
</AnimatedTabs>
```

Give `AnimatedTabs` a `defaultValue` or `value` that matches one of the tab values.

## Accessibility [#accessibility]

Roles, selection state, and keyboard support come from Base UI Tabs: the list is a `tablist`, arrow keys move between tabs, and each panel is labelled by its tab. Name the list with `aria-label` when there is no visible heading. The indicator is decorative and hidden from assistive technology. With reduced motion enabled, the indicator fades to the new tab instead of sliding.

## API Reference [#api-reference]


  ### `value / defaultValue`

type: `string | number`

Selected tab on 

    `AnimatedTabs`

    , controlled or initial.

  ### `onValueChange`



void">
    Called when the selected tab changes.

  ### `variant`

type: `&#x22;pill&#x22; | &#x22;underline&#x22;` · default: `&#x22;pill&#x22;`

Indicator style, on 

    `AnimatedTabsList`

    .

  ### `indicatorClassName`

type: `string`

Classes for the moving indicator.

  ### `transition`

type: `Transition` · default: `SPRING_LAYOUT`

Spring or tween for the indicator.

  ### `value`

type: `string | number`

Value of an 

    `AnimatedTabsTab`

     and its 

    `AnimatedTabsPanel`

    .


`AnimatedTabs`, `AnimatedTabsList`, `AnimatedTabsTab`, and `AnimatedTabsPanel` also accept the props of Base UI's `Tabs.Root`, `Tabs.List`, `Tabs.Tab`, and `Tabs.Panel`.
