# Tabs

> Pill segmented tabs with a sliding indicator.

Registry name: `tabs`. HTML docs: https://ui.anuragroy.dev/component/tabs.

## Install

```bash
npx shadcn@latest add https://ui.anuragroy.dev/r/tabs.json
```

If the website is down: `npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/tabs.json`.

Registry JSON: https://ui.anuragroy.dev/r/tabs.json (GitHub: https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/tabs.json).

## Import

Import paths follow the consumer `components.json` aliases. After a default install:

```tsx
import {
  Tabs,
  TabsIndicator,
  TabsList,
  TabsPanel,
  TabsTab
} from "@/components/ui/tabs"
```

## Usage

```tsx
import {
  Tabs,
  TabsIndicator,
  TabsList,
  TabsPanel,
  TabsTab,
} from "@/components/ui/tabs"

export function Example() {
  return (
    <Tabs defaultValue="one">
      <TabsList>
        <TabsIndicator />
        <TabsTab value="one">One</TabsTab>
        <TabsTab value="two">Two</TabsTab>
      </TabsList>
      <TabsPanel value="one">First panel</TabsPanel>
      <TabsPanel value="two">Second panel</TabsPanel>
    </Tabs>
  )
}
```

## API

### Tabs

Base UI Tabs root.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `defaultValue` | string | — |  |
| `value` | string | — |  |
| `onValueChange` | (value: string) => void | — |  |

### TabsTab

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | string | — |  |

## Notes

- Render `TabsIndicator` inside `TabsList` so the pill tracks the active tab.
- `TabsTab` must live inside `TabsList`.

## See also

- [HTML page](https://ui.anuragroy.dev/component/tabs): Preview and the same docs in the site chrome.
- [Registry item](https://ui.anuragroy.dev/r/tabs.json): Source files and dependencies.
- [Catalog](https://ui.anuragroy.dev/component): All components.
- [llms.txt](https://ui.anuragroy.dev/llms.txt): Agent index for this library.
