# Tabs

Switch between connected panels with an animated underline.

Access: pro. Category: Navigation. Kind: composite.

## When to use

- Use it when a page needs switch between connected panels with an animated underline.
- Choose it as the nav region when composing a page from independently reusable TidalUI sections.

## Alternatives

- Choose navigation-bar instead when responsive saas navigation with native links, actions and an in-flow mobile disclosure is the actual interface need, rather than tabs.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Tabs

```sh
npx shadcn@latest add @tidal-pro/tabs
```

Stylesheets: `components/ui/tidal.css`, `components/ui/tabs.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/tabs.css";
import{TidalTabs}from"./components/ui/tabs";
export default()=><div className="tidal-scope"><TidalTabs items={[{value:"value",label:"Demo",content:"value"}]} label={"Demo"} onValueChange={() => {}} value={"value"}/></div>;
```

## Structured props

- `TidalTabs.items: Array<TidalTab>`: Required items value accepted by this exported component.
- `TidalTabs.label: string`: Required label value accepted by this exported component.
- `TidalTabs.onValueChange: (value: string) => void`: Callback invoked when the value change interaction is proposed.
- `TidalTabs.value: string`: Required value value accepted by this exported component.
- `TidalTabs.activationMode?: "manual" | "automatic" | undefined` (default "automatic"): Optional activation mode value accepted by this exported component.
- `TidalTabs.animateHeight?: boolean | undefined` (default true): Smooth natural-height panel changes. Disable for externally constrained or overflowing content.
- `TidalTabs.className?: string | undefined` (default ""): Optional class name value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/tabs.tsx) | [Manifest](https://tidalui.com/examples/tabs.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { Download } from "lucide-react";

import { TidalTabs } from "./components/ui/tabs";

import "./components/ui/tabs.css";

import { LayoutGrid, Activity, Folder } from "lucide-react";

import { TidalCheckbox } from "./components/ui/checkbox";

import "./components/ui/checkbox.css";

import { useState, type CSSProperties } from "react";

import { Check } from "lucide-react";



const tidalExampleStyles = ".tabs-specimen{width:100%;max-width:425px;background:var(--t-surface);border:1px solid var(--t-border);border-radius:17px;padding:25px;box-shadow:0 8px 24px #1f1f1f07}.tabs-demo-heading>.demo-eyebrow{font-size:11px}.tabs-demo-heading>h3{font-size:23px;letter-spacing:-.8px;color:var(--t-ink);margin:12px 0 21px}.tabs-demo-overview>div:first-child{display:flex;justify-content:space-between;align-items:center;font-size:11px;letter-spacing:.5px;color:var(--t-muted)}.tabs-demo-overview strong{font-size:39px;letter-spacing:-1.5px;font-weight:500;color:var(--t-ink)}.tabs-demo-overview strong>span{font-size:19px;margin-left:2px;color:var(--t-muted)}.tabs-demo-overview>p{font-size:11px;color:var(--t-muted);margin:6px 0 20px}.tabs-demo-bar{height:7px;border-radius:7px;background:var(--t-subtle);overflow:hidden}.tabs-demo-bar>span{display:block;width:67%;height:100%;border-radius:7px;background:linear-gradient(90deg,var(--t-accent),var(--t-muted))}.tabs-demo-bottom{display:flex;justify-content:space-between;font-size:11px;color:var(--t-muted);margin-top:12px}.tabs-demo-bottom>span:last-child{color:var(--t-accent)}.tabs-demo-activity>h4{font-size:16px;font-weight:500;letter-spacing:-.4px;color:var(--t-ink);margin:0 0 17px}.tabs-demo-activity>div{display:flex;align-items:center;gap:12px;margin-top:14px}.tabs-demo-activity>div>span{font-size:11px;background:var(--t-wash);color:var(--t-accent);width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0}.tabs-demo-activity p{margin:0}.tabs-demo-activity strong{font-size:11px;display:block;font-weight:500;color:var(--t-ink)}.tabs-demo-activity small{display:block;font-size:11px;color:var(--t-muted);margin-top:4px}\n\n\n.tabs-specimen{max-width:560px;padding:26px;border-radius:var(--t-radius-card);background:linear-gradient(150deg,var(--t-surface),color-mix(in srgb,var(--t-surface) 94%,var(--t-subtle)));box-shadow:0 24px 40px -28px #00000035,0 2px 4px #00000008}.tabs-demo-heading>h3{font-size:26px;margin:12px 0 25px;letter-spacing:-.9px}.tabs-demo-overview>div:first-child{align-items:center}.tabs-demo-overview strong{font-size:44px;line-height:1.12}.tabs-demo-overview strong>span{font-size:inherit;margin:0;color:var(--t-ink)}.tabs-demo-overview strong>.tabs-demo-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;margin:-1px}.tabs-demo-overview strong>.tabs-demo-counter{display:flex;align-items:baseline;font-variant-numeric:tabular-nums;letter-spacing:0}.tabs-demo-digit-window{display:block;overflow:hidden;width:1ch;height:1.12em;transition:width 320ms var(--t-ease-out),opacity 180ms}.tabs-demo-digit-window[data-leading=true]{width:0;opacity:0}.tabs-demo-digit-window>span{display:flex;flex-direction:column;transition:transform 650ms var(--t-ease-out)}.tabs-demo-digit-window>span>span{height:1.12em;line-height:1.12;flex:none;text-align:center}.tabs-demo-percent{font-size:.45em;color:var(--t-muted);margin-left:3px}.tabs-demo-bar{height:6px;background:var(--t-wash)}.tabs-demo-bar>span{background:var(--t-ink);transition:width 650ms var(--t-ease-out)}.tabs-demo-tasks{margin-top:23px;padding-top:16px;border-top:1px solid var(--t-border);display:flex;flex-direction:column;gap:3px}.tabs-demo-tasks .tidal-checkbox-label{font-size:11px}.tabs-demo-activity>div{position:relative;border-bottom:1px solid var(--t-border);padding:12px 0;margin:0;min-height:62px}.tabs-demo-activity>div:last-child{border-bottom:0}.tabs-demo-activity>div>span{border-radius:7px;background:var(--t-ink);color:var(--t-surface);font-size:11px}.tabs-demo-activity strong{font-size:11px;line-height:1.6}.tabs-demo-activity small{font-size:11px}.tabs-demo-files>h4{font-size:16px;letter-spacing:-.4px;font-weight:500;margin:0 0 16px}.tabs-demo-files>a{display:flex;align-items:center;gap:12px;min-height:62px;padding:12px 0;text-decoration:none;color:var(--t-ink);border-top:1px solid var(--t-border)}.tabs-demo-files>a>span{flex:1;min-width:0}.tabs-demo-files strong{display:block;font-size:11px;font-weight:550}.tabs-demo-files small{display:block;font-size:11px;color:var(--t-muted);margin-top:4px}.tabs-demo-files>a>svg:last-child{color:var(--t-muted);transition:transform 240ms var(--t-ease-out)}.tabs-demo-files>a:hover>svg:last-child{transform:translateY(2px)}\n@media(prefers-reduced-motion:no-preference){.tabs-demo-activity>div{animation:tidal-tab-content-in 320ms var(--activity-delay) var(--t-ease-out) both}}\n@media(max-width:420px){.tabs-specimen{padding:20px}.tabs-demo-heading>h3{font-size:24px}.tabs-specimen .tidal-tab-trigger{font-size:11px;padding-inline:10px;gap:5px}}";

export function TabsDemo() {
  const [tab, setTab] = useState("overview");
  const [tasks, setTasks] = useState([true, true, false]);
  const [events, setEvents] = useState([
    {
      initials: "AL",
      text: "Alex finished the first draft.",
      detail: "Sample project activity",
    },
    {
      initials: "JR",
      text: "Jordan shared a new idea.",
      detail: "Sample project activity",
    },
  ]);
  const labels = [
    "Finalize the brand",
    "Build the homepage",
    "Prepare launch notes",
  ];
  const completed = tasks.filter(Boolean).length;
  const percent = Math.round((completed / tasks.length) * 100);
  return (
    <div className="tabs-specimen">
      <div className="tabs-demo-heading"></div>
      <TidalTabs
        label="Northstar project views"
        value={tab}
        onValueChange={setTab}
        items={[
          {
            value: "overview",
            label: "Overview",
            icon: LayoutGrid,
            content: (
              <div className="tabs-demo-overview">
                <div>
                  <span>PROJECT PROGRESS</span>
                  <strong>
                    <span className="tabs-demo-sr">{percent} percent</span>
                    <span className="tabs-demo-counter" aria-hidden="true">
                      {[
                        Math.floor(percent / 100),
                        Math.floor(percent / 10) % 10,
                        percent % 10,
                      ].map((digit, i) => (
                        <span
                          className="tabs-demo-digit-window"
                          data-leading={i === 0 && digit === 0}
                          key={i}
                        >
                          <span
                            style={{
                              transform: `translateY(${-digit * 1.12}em)`,
                            }}
                          >
                            {Array.from({ length: 10 }, (_, n) => (
                              <span key={n}>{n}</span>
                            ))}
                          </span>
                        </span>
                      ))}
                      <span className="tabs-demo-percent">%</span>
                    </span>
                  </strong>
                </div>
                <p>
                  {completed === tasks.length
                    ? "All milestones complete."
                    : "Complete the remaining milestones."}
                </p>
                <div className="tabs-demo-bar" aria-hidden="true">
                  <span style={{ width: `${percent}%` }} />
                </div>
                <div className="tabs-demo-bottom">
                  <span>
                    {completed} of {tasks.length} milestones complete
                  </span>
                  <span>
                    {completed === tasks.length
                      ? "Ready to launch"
                      : "In progress"}
                  </span>
                </div>
                <div className="tabs-demo-tasks">
                  {labels.map((label, i) => (
                    <TidalCheckbox
                      key={label}
                      label={label}
                      checked={tasks[i]}
                      onCheckedChange={(checked) => {
                        const next = checked === true;
                        setTasks((current) =>
                          current.map((value, index) =>
                            index === i ? next : value,
                          ),
                        );
                        setEvents((current) =>
                          [
                            {
                              initials: "YOU",
                              text: `You ${next ? "completed" : "reopened"} ${label.toLowerCase()}.`,
                              detail: "Changed in this sample preview",
                            },
                            ...current,
                          ].slice(0, 5),
                        );
                      }}
                    />
                  ))}
                </div>
              </div>
            ),
          },
          {
            value: "activity",
            label: "Activity",
            icon: Activity,
            count: events.length,
            content: (
              <div className="tabs-demo-activity">
                <h4>Recent activity</h4>
                {events.map((event, i) => (
                  <div
                    key={`${event.text}-${i}`}
                    style={
                      { "--activity-delay": `${i * 50}ms` } as CSSProperties
                    }
                  >
                    <span>{event.initials}</span>
                    <p>
                      <strong>{event.text}</strong>
                      <small>{event.detail}</small>
                    </p>
                  </div>
                ))}
              </div>
            ),
          },
          {
            value: "files",
            label: "Files",
            icon: Folder,
            count: 2,
            content: (
              <div className="tabs-demo-files">
                <h4>Project files</h4>
                <a href="/sample-project-brief.txt" download>
                  <Folder size={17} aria-hidden="true" />
                  <span>
                    <strong>Project brief</strong>
                    <small>Sample content · .txt</small>
                  </span>
                  <Download size={15} aria-hidden="true" />
                </a>
                <a href="/sample-launch-checklist.md" download>
                  <Check size={17} aria-hidden="true" />
                  <span>
                    <strong>Launch checklist</strong>
                    <small>Sample content · .md</small>
                  </span>
                  <Download size={15} aria-hidden="true" />
                </a>
              </div>
            ),
          },
        ]}
      />
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <TabsDemo />
    </div>
  );
}

```

## Gotchas

- Install the declared registry dependencies and render inside a tidal-scope with the foundation stylesheet loaded.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Controlled label, items ({value,label,content:ReactNode,Lucide icon?,count?,disabled?}[]), value, onValueChange. Optional activationMode automatic|manual, animateHeight (default true; disable for externally constrained/overflowing content) and className. Shared indicator follows selection and responsive widths; natural panel heights interpolate. Unique nonempty values, select an enabled item. Radix horizontal arrows/Home/End, disabled skipping, connected tab/panel semantics. Manual mode activates on Enter/Space. Inactive content unmounts, so lift any persistent form state above tabs.
