# Tabs

Switch between related views of the same thing.

- **Use it for**: Switching between related views of one subject.
- **Not for**: Navigating to different pages, or filtering one list. Try [NavigationMenu](https://unseenui.com/components/navigation-menu/), [ToggleGroup](https://unseenui.com/components/toggle-group/).

## Installation

```bash
npm install @stackunseen/ui
```

## Usage

```tsx
import { Tabs } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<Tabs variant="underline" value={tab} onValueChange={setTab} items={views} label="Report views" />
```

## Props

- `value` (`string`): The active item value.
- `onValueChange` (`(value: string) => void`): Update value when a different tab is selected.
- `items` (`{ value: string; label: string; content: ReactNode }[]`): Each item needs a unique value, a visible label and its panel content.
- `label` (`string`): The accessible name for this group of tabs.

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `items` (required) | `{ value: string; label: string; content: ReactNode; }[]` |  |
| `label` (required) | `string` |  |
| `onValueChange` (required) | `(value: string) => void` |  |
| `orientation` | `"horizontal" \| "vertical"` | "vertical" lists the tabs beside the panel, as settings dialogs do; arrow keys then move up and down. |
| `value` (required) | `string` |  |
| `variant` | `"segmented" \| "underline" \| "pills"` |  |

## Keyboard

Tab focuses the selected tab. Left and Right arrows, Home and End move between tabs and activate them. Tab then moves into the active panel.

## Works with

[CommandPalette](https://unseenui.com/components/command-palette/), [ShortcutHelp](https://unseenui.com/components/shortcut-help/), [TableOfContents](https://unseenui.com/components/table-of-contents/), [Breadcrumb](https://unseenui.com/components/breadcrumb/), [Stepper](https://unseenui.com/components/stepper/), [Pagination](https://unseenui.com/components/pagination/), [DropdownMenu](https://unseenui.com/components/dropdown-menu/), [ContextMenu](https://unseenui.com/components/context-menu/), [NavigationMenu](https://unseenui.com/components/navigation-menu/), [Sidebar](https://unseenui.com/components/sidebar/), [ShareMenu](https://unseenui.com/components/share-menu/)

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