---
title: "Tabs"
description: "A row of tabs that switch the panel under them, such as Overview, Activity, and Settings. A sliding mark shows the open tab."
url: https://gelatinui.com/components/tabs
markdown_url: https://gelatinui.com/components/tabs.md
access: free
install: "npx shadcn@latest add @gelatin-ui/tabs"
registry_item: https://gelatinui.com/r/tabs.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Tabs

> A row of tabs that switch the panel under them, such as Overview, Activity, and Settings. A sliding mark shows the open tab.

Page: https://gelatinui.com/components/tabs

## When to use it

Best for: Views of one thing in one shared place: Overview, Activity, Settings.

- Use it to switch views of one thing.
- Use `variant="line"` at the top of a page.
- Use `orientation="vertical"` for a settings page.

## When not to use it

- To set one value with no panels, use a [Segmented Control](https://gelatinui.com/components/segmented-control.md).
- To keep each heading in the flow, use an accordion.

## Notes for agents

- `defaultValue` is `0` by default. `null` means no active tab.
- `activateOnFocus` is on by default: an arrow key shows the panel at once.
- `keepMounted` on a panel keeps a form in a hidden tab.
- For links, pass `render={<a href="…" />}` and `nativeButton={false}` on the trigger.
- Too many tabs for a phone: put the list in a horizontal scroll area.

## Anatomy

```text
Tabs
├─ TabsList (0..n)
├─ TabsTrigger (0..n)
└─ TabsContent (0..n)
```

## API reference

### Tabs

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Tabs.Root`: https://base-ui.com/react/components/tabs

### TabsList

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `rounded` | `"default" \| "full"` | "default" |  |
| `size` | `"default" \| "lg" \| "sm"` | "default" |  |
| `variant` | `"default" \| "folder" \| "line"` | "default" |  |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Tabs.List`: https://base-ui.com/react/components/tabs

### TabsTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Tabs.Tab`: https://base-ui.com/react/components/tabs

### TabsContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `gap` | `"default" \| "none"` | "default" | The space between the list and the panel: `default` (12px) or `none`, for a panel that sits flush under a list in a head with its own edge (the JSX Preview stage). |

Also takes every prop of Base UI `Tabs.Panel`: https://base-ui.com/react/components/tabs

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Tabs | `tabs` | `data-orientation` |  |  |
| TabsList | `tabs-list` | `data-orientation` | `--radius` | `hit-area` |
| TabsTrigger | `tabs-trigger` | `data-active`, `data-disabled`, `data-orientation`, `data-rounded`, `data-size`, `data-variant` | `--foreground`, `--muted`, `--radius`, `--tabs-folder-curve-end`, `--tabs-folder-curve-start`, `--tabs-folder-fill` | `hit-area` |
| TabsContent | `tabs-content` | `data-activation-direction`, `data-ending-style`, `data-gap`, `data-orientation`, `data-starting-style`, `data-variant` |  | `motion-timing` |

## Usage

Compose the list and the panels.

```tsx title="project-tabs.tsx"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";

export function ProjectTabs() {
  return (
    <Tabs defaultValue="overview">
      <TabsList>
        <TabsTrigger value="overview">Overview</TabsTrigger>
        <TabsTrigger value="activity">Activity</TabsTrigger>
      </TabsList>
      <TabsContent value="overview">Northwind has 12 open tasks this week.</TabsContent>
      <TabsContent value="activity">Mila closed three tasks today.</TabsContent>
    </Tabs>
  );
}
```

## Compose

Rules:

- Touch targets (`touch-targets`): Give every control a hit area of at least 44 px on touch screens, even when it looks smaller.
- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/tabs
```

It adds 12 registry items: 10 files, 2141 lines, and the npm packages `@base-ui/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Segmented Control](https://gelatinui.com/components/segmented-control.md): Pick Segmented Control to set one value with no panels, such as a view mode that a form sends.
- [Thumb Bar](https://gelatinui.com/components/thumb-bar.md)
- [Toggle Group](https://gelatinui.com/components/toggle-group.md): Pick Toggle Group for a row of toggles that set one value or many, with no panels.
- [Navigation Menu](https://gelatinui.com/components/navigation-menu.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Left Arrow, Right Arrow | Moves to the tab before or after. Up and Down do it when vertical. |
| Home, End | Goes to the first or the last tab. |
| Tab | Moves to the panel. |

## Accessibility

The list has the tablist role. Give it an `aria-label` when no heading names it.

A disabled tab is skipped by the arrow keys.

Each tab keeps a 44px touch target.

## Motion

| Part | Motion |
| --- | --- |
| Indicator | panel · the indicator slides to the active tab |
| Panel | fade · the panels fade in one place |
