# Tabs

URL: https://ark-ui.com/docs/react/components/tabs
Markdown: https://ark-ui.com/docs/react/components/tabs.md

Flexible navigation tool with various modes and features.

---

---
id: tabs
title: Tabs
description: Flexible navigation tool with various modes and features.
---



## Anatomy



```tsx
<Tabs.Root>
  <Tabs.List>
    <Tabs.Trigger />
    <Tabs.Indicator />
  </Tabs.List>
  <Tabs.Content />
</Tabs.Root>
```

## Examples

```tsx
import { Tabs } from '@ark-ui/react/tabs'
import styles from 'styles/tabs.module.css'

export const Basic = () => (
  <Tabs.Root className={styles.Root} defaultValue="account">
    <Tabs.List className={styles.List}>
      <Tabs.Trigger className={styles.Trigger} value="account">
        Account
      </Tabs.Trigger>
      <Tabs.Trigger className={styles.Trigger} value="password">
        Password
      </Tabs.Trigger>
      <Tabs.Trigger className={styles.Trigger} value="billing">
        Billing
      </Tabs.Trigger>
    </Tabs.List>
    <Tabs.Content className={styles.Content} value="account">
      Make changes to your account here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="password">
      Change your password here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="billing">
      Manage your billing and payment details.
    </Tabs.Content>
  </Tabs.Root>
)
```

### Controlled

Pass `value` and update it in `onValueChange`.

```tsx
import { Tabs } from '@ark-ui/react/tabs'
import { useState } from 'react'
import styles from 'styles/tabs.module.css'

export const Controlled = () => {
  const [value, setValue] = useState<string | null>('account')
  return (
    <Tabs.Root className={styles.Root} value={value} onValueChange={(e) => setValue(e.value)}>
      <Tabs.List className={styles.List}>
        <Tabs.Trigger className={styles.Trigger} value="account">
          Account
        </Tabs.Trigger>
        <Tabs.Trigger className={styles.Trigger} value="password">
          Password
        </Tabs.Trigger>
        <Tabs.Trigger className={styles.Trigger} value="billing">
          Billing
        </Tabs.Trigger>
      </Tabs.List>
      <Tabs.Content className={styles.Content} value="account">
        Make changes to your account here.
      </Tabs.Content>
      <Tabs.Content className={styles.Content} value="password">
        Change your password here.
      </Tabs.Content>
      <Tabs.Content className={styles.Content} value="billing">
        Manage your billing and payment details.
      </Tabs.Content>
    </Tabs.Root>
  )
}
```

### Root Provider

Use `RootProvider` with the `useTabs` hook to access the state and methods from outside the component.

```tsx
import { Tabs, useTabs } from '@ark-ui/react/tabs'
import styles from 'styles/tabs.module.css'

export const RootProvider = () => {
  const tabs = useTabs({ defaultValue: 'account' })

  return (
    <div className="stack">
      <output>selected: {tabs.value}</output>
      <Tabs.RootProvider className={styles.Root} value={tabs}>
        <Tabs.List className={styles.List}>
          <Tabs.Trigger className={styles.Trigger} value="account">
            Account
          </Tabs.Trigger>
          <Tabs.Trigger className={styles.Trigger} value="password">
            Password
          </Tabs.Trigger>
          <Tabs.Trigger className={styles.Trigger} value="billing">
            Billing
          </Tabs.Trigger>
        </Tabs.List>
        <Tabs.Content className={styles.Content} value="account">
          Make changes to your account here.
        </Tabs.Content>
        <Tabs.Content className={styles.Content} value="password">
          Change your password here.
        </Tabs.Content>
        <Tabs.Content className={styles.Content} value="billing">
          Manage your billing and payment details.
        </Tabs.Content>
      </Tabs.RootProvider>
    </div>
  )
}
```

### Indicator

`Tabs.Indicator` marks the selected tab.

```tsx
import { Tabs } from '@ark-ui/react/tabs'
import styles from 'styles/tabs.module.css'

export const Indicator = () => (
  <Tabs.Root className={styles.Root} defaultValue="account">
    <Tabs.List className={styles.List}>
      <Tabs.Trigger className={styles.TriggerIndicator} value="account">
        Account
      </Tabs.Trigger>
      <Tabs.Trigger className={styles.TriggerIndicator} value="password">
        Password
      </Tabs.Trigger>
      <Tabs.Trigger className={styles.TriggerIndicator} value="billing">
        Billing
      </Tabs.Trigger>
      <Tabs.Indicator className={styles.Indicator} />
    </Tabs.List>
    <Tabs.Content className={styles.Content} value="account">
      Make changes to your account here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="password">
      Change your password here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="billing">
      Manage your billing and payment details.
    </Tabs.Content>
  </Tabs.Root>
)
```

### Disabled

Pass `disabled` to a `Tabs.Trigger`.

```tsx
import { Tabs } from '@ark-ui/react/tabs'
import styles from 'styles/tabs.module.css'

export const DisabledTab = () => (
  <Tabs.Root className={styles.Root} defaultValue="account">
    <Tabs.List className={styles.List}>
      <Tabs.Trigger className={styles.Trigger} value="account">
        Account
      </Tabs.Trigger>
      <Tabs.Trigger className={styles.Trigger} value="password" disabled>
        Password
      </Tabs.Trigger>
      <Tabs.Trigger className={styles.Trigger} value="billing">
        Billing
      </Tabs.Trigger>
    </Tabs.List>
    <Tabs.Content className={styles.Content} value="account">
      Make changes to your account here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="password">
      Change your password here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="billing">
      Manage your billing and payment details.
    </Tabs.Content>
  </Tabs.Root>
)
```

### Vertical

Tabs are horizontal by default. Set `orientation="vertical"` to stack them.

```tsx
import { Tabs } from '@ark-ui/react/tabs'
import styles from 'styles/tabs.module.css'

export const Vertical = () => (
  <Tabs.Root className={styles.Root} orientation="vertical" defaultValue="account">
    <Tabs.List className={styles.List}>
      <Tabs.Trigger className={styles.Trigger} value="account">
        Account
      </Tabs.Trigger>
      <Tabs.Trigger className={styles.Trigger} value="password">
        Password
      </Tabs.Trigger>
      <Tabs.Trigger className={styles.Trigger} value="billing">
        Billing
      </Tabs.Trigger>
    </Tabs.List>
    <Tabs.Content className={styles.Content} value="account">
      Make changes to your account here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="password">
      Change your password here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="billing">
      Manage your billing and payment details.
    </Tabs.Content>
  </Tabs.Root>
)
```

### Lazy Mount

Set `lazyMount` to render a tab's content only when the tab is first activated. This helps when content is large.

Add `unmountOnExit` to unmount the content when the tab is deactivated. It re-renders the next time the tab activates.

```tsx
import { Tabs } from '@ark-ui/react/tabs'
import styles from 'styles/tabs.module.css'

export const LazyMount = () => (
  <Tabs.Root className={styles.Root} lazyMount unmountOnExit defaultValue="account">
    <Tabs.List className={styles.List}>
      <Tabs.Trigger className={styles.TriggerIndicator} value="account">
        Account
      </Tabs.Trigger>
      <Tabs.Trigger className={styles.TriggerIndicator} value="password">
        Password
      </Tabs.Trigger>
      <Tabs.Trigger className={styles.TriggerIndicator} value="billing">
        Billing
      </Tabs.Trigger>
      <Tabs.Indicator className={styles.Indicator} />
    </Tabs.List>
    <Tabs.Content className={styles.Content} value="account">
      Make changes to your account here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="password">
      Change your password here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="billing">
      Manage your billing and payment details.
    </Tabs.Content>
  </Tabs.Root>
)
```

### Manual Activation

By default, a tab is selected as soon as it receives focus (automatic activation). With manual activation, a tab is
selected only by pressing <kbd>Enter</kbd> or clicking it.

```tsx
import { Tabs } from '@ark-ui/react/tabs'
import styles from 'styles/tabs.module.css'

export const ManualActivation = () => (
  <Tabs.Root className={styles.Root} activationMode="manual" defaultValue="account">
    <Tabs.List className={styles.List}>
      <Tabs.Trigger className={styles.Trigger} value="account">
        Account
      </Tabs.Trigger>
      <Tabs.Trigger className={styles.Trigger} value="password">
        Password
      </Tabs.Trigger>
      <Tabs.Trigger className={styles.Trigger} value="billing">
        Billing
      </Tabs.Trigger>
    </Tabs.List>
    <Tabs.Content className={styles.Content} value="account">
      Make changes to your account here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="password">
      Change your password here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="billing">
      Manage your billing and payment details.
    </Tabs.Content>
  </Tabs.Root>
)
```

### Links

Use `asChild` to render triggers as anchor links. This helps SEO and works with browser navigation.

```tsx
import { Tabs } from '@ark-ui/react/tabs'
import styles from 'styles/tabs.module.css'

export const Links = () => (
  <Tabs.Root className={styles.Root} defaultValue="account">
    <Tabs.List className={styles.List}>
      <Tabs.Trigger className={styles.Trigger} value="account" render={<a href="#account">Account</a>} />
      <Tabs.Trigger className={styles.Trigger} value="password" render={<a href="#password">Password</a>} />
      <Tabs.Trigger className={styles.Trigger} value="billing" render={<a href="#billing">Billing</a>} />
    </Tabs.List>
    <Tabs.Content className={styles.Content} value="account">
      Make changes to your account here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="password">
      Change your password here.
    </Tabs.Content>
    <Tabs.Content className={styles.Content} value="billing">
      Manage your billing and payment details.
    </Tabs.Content>
  </Tabs.Root>
)
```

## Guides

### Router Integration

To sync the active tab with the URL in Next.js, Remix or React Router:

- Set `value` from the current URL path.
- Update the URL path in `onValueChange`.

Here's an example with Remix:

```tsx
import { Tabs } from '@ark-ui/<framework>/tabs'
import { useLocation, useNavigate, Link } from '@remix-run/react'

export default function App() {
  const { pathname } = useLocation()
  const navigate = useNavigate()
  const lastPathFragment = pathname.substring(pathname.lastIndexOf('/') + 1)
  const activeTab = lastPathFragment.length > 0 ? lastPathFragment : 'homepage'

  return (
    <Tabs.Root
      value={activeTab}
      onValueChange={({ value }) => {
        navigate(`/${value === 'home' ? '' : value}`)
      }}
    >
      <Tabs.List>
        <Tabs.Trigger asChild value="home">
          <Link to="">Home</Link>
        </Tabs.Trigger>
        <Tabs.Trigger asChild value="page-1">
          <Link to="page-1">Page 1</Link>
        </Tabs.Trigger>
        <Tabs.Trigger asChild value="page-2">
          <Link to="page-2">Page 2</Link>
        </Tabs.Trigger>
      </Tabs.List>
    </Tabs.Root>
  )
}
```



## API Reference

### Props

### Root

#### Props

**`activationMode`**
Type: `'manual' | 'automatic'`
Required: false
Default Value: `"automatic"`
Description: The activation mode of the tabs. Can be `manual` or `automatic`
- `manual`: Tabs are activated when clicked or press `enter` key.
- `automatic`: Tabs are activated when receiving focus

**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.

Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

**`defaultValue`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The initial selected tab value when rendered.
Use when you don't need to control the selected tab value.

**`deselectable`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the active tab can be deselected when clicking on it.

**`hideMode`**
Type: `HideMode`
Required: false
Default Value: `'display-none'`
Description: How to hide content when mounted but not present.
- `'display-none'`: HTML `hidden` attribute. Effects stay alive.
- `'activity'`: React 19 `<Activity mode="hidden">`. Effects pause. Requires React 19+.

**`id`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The unique identifier of the machine.

**`ids`**
Type: `ElementIds`
Required: false
Default Value: `undefined`
Description: The ids of the elements in the tabs. Useful for composition.

**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting

**`loopFocus`**
Type: `boolean`
Required: false
Default Value: `true`
Description: Whether the keyboard navigation will loop from last tab to first, and vice versa.

**`navigate`**
Type: `(details: NavigateDetails) => void`
Required: false
Default Value: `undefined`
Description: Function to navigate to the selected tab when clicking on it.
Useful if tab triggers are anchor elements.

**`onFocusChange`**
Type: `(details: FocusChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback to be called when the focused tab changes

**`onValueChange`**
Type: `(details: ValueChangeDetails) => void`
Required: false
Default Value: `undefined`
Description: Callback to be called when the selected/active tab changes

**`orientation`**
Type: `'horizontal' | 'vertical'`
Required: false
Default Value: `"horizontal"`
Description: The orientation of the tabs. Can be `horizontal` or `vertical`
- `horizontal`: only left and right arrow key navigation will work.
- `vertical`: only up and down arrow key navigation will work.

**`render`**
Type: `ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>`
Required: false
Default Value: `undefined`
Description: Render the part as a custom element, combining their props and behavior.

Pass an element to have the part's props merged into it, or a function to control the merge
yourself and read the part's state.

**`translations`**
Type: `IntlTranslations`
Required: false
Default Value: `undefined`
Description: Specifies the localized strings that identifies the accessibility elements and their states

**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.

**`value`**
Type: `string`
Required: false
Default Value: `undefined`
Description: The controlled selected tab value

**`virtualFocus`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether the tabs use virtual focus instead of roving tabindex.

When `true`, triggers receive no DOM focus — arrow keys update `focusedValue`
and all triggers remain `tabIndex: -1`. Useful when tabs live inside another
widget that manages focus (e.g. a combobox).

#### Data Attributes

**`data-tabs-root`**: <uid>
**`data-orientation`**: The orientation of the tabs
**`data-focus`**: Present when focused
**`data-activation-direction`**: 

### TabContent

#### Props

**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the tab

**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.

Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

**`render`**
Type: `ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<TabContentState>`
Required: false
Default Value: `undefined`
Description: Render the part as a custom element, combining their props and behavior.

Pass an element to have the part's props merged into it, or a function to control the merge
yourself and read the part's state.

### TabIndicator

#### Props

**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.

Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

**`render`**
Type: `ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>`
Required: false
Default Value: `undefined`
Description: Render the part as a custom element, combining their props and behavior.

Pass an element to have the part's props merged into it, or a function to control the merge
yourself and read the part's state.

### TabList

#### Props

**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.

Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

**`render`**
Type: `ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>`
Required: false
Default Value: `undefined`
Description: Render the part as a custom element, combining their props and behavior.

Pass an element to have the part's props merged into it, or a function to control the merge
yourself and read the part's state.

### TabTrigger

#### Props

**`value`**
Type: `string`
Required: true
Default Value: `undefined`
Description: The value of the tab

**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.

Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

**`disabled`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Whether the tab is disabled

**`render`**
Type: `ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<TabTriggerState>`
Required: false
Default Value: `undefined`
Description: Render the part as a custom element, combining their props and behavior.

Pass an element to have the part's props merged into it, or a function to control the merge
yourself and read the part's state.

### RootProvider

#### Props

**`value`**
Type: `UseTabsReturn`
Required: true
Default Value: `undefined`
Description: undefined

**`asChild`**
Type: `boolean`
Required: false
Default Value: `undefined`
Description: Use the provided child element as the default rendered element, combining their props and behavior.

Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

**`hideMode`**
Type: `HideMode`
Required: false
Default Value: `'display-none'`
Description: How to hide content when mounted but not present.
- `'display-none'`: HTML `hidden` attribute. Effects stay alive.
- `'activity'`: React 19 `<Activity mode="hidden">`. Effects pause. Requires React 19+.

**`lazyMount`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to enable lazy mounting

**`render`**
Type: `ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>`
Required: false
Default Value: `undefined`
Description: Render the part as a custom element, combining their props and behavior.

Pass an element to have the part's props merged into it, or a function to control the merge
yourself and read the part's state.

**`unmountOnExit`**
Type: `boolean`
Required: false
Default Value: `false`
Description: Whether to unmount on exit.

### Context

**API:**

| Property | Type | Description |
|----------|------|-------------|
| `value` | `string | null` | The current value of the tabs. |
| `focusedValue` | `string | null` | The value of the tab that is currently focused. |
| `activationDirection` | `ActivationDirection` | Where the selected tab sits relative to the previously selected one |
| `setValue` | `(value: string, reason?: ValueChangeReason) => void` | Sets the value of the tabs. |
| `clearValue` | `VoidFunction` | Clears the value of the tabs. |
| `setIndicatorRect` | `(value: string) => void` | Sets the indicator rect to the tab with the given value |
| `syncTabIndex` | `VoidFunction` | Synchronizes the tab index of the content element.
Useful when rendering tabs within a select or combobox |
| `focus` | `VoidFunction` | Set focus on the selected tab trigger |
| `selectNext` | `(fromValue?: string) => void` | Selects the next enabled tab, without moving focus |
| `selectPrevious` | `(fromValue?: string) => void` | Selects the previous enabled tab, without moving focus |
| `getTriggerState` | `(props: TriggerProps) => TriggerState` | Returns the state of the trigger with the given props |
| `getRootState` | `() => RootState` | Returns the state of the root. The list shares it. |
| `getContentState` | `(props: ContentProps) => ContentState` | Returns the state of the content with the given props |
| `getIndicatorState` | `() => IndicatorState` | Returns the state of the indicator |


## Accessibility

Complies with the [Tabs WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/).

### Keyboard Support

**`Tab`**
Description: When focus moves onto the tabs, focuses the active trigger. When a trigger is focused, moves focus to the active content.

**`ArrowDown`**
Description: Moves focus to the next trigger in vertical orientation and activates its associated content.

**`ArrowRight`**
Description: Moves focus to the next trigger in horizontal orientation and activates its associated content.

**`ArrowUp`**
Description: Moves focus to the previous trigger in vertical orientation and activates its associated content.

**`ArrowLeft`**
Description: Moves focus to the previous trigger in horizontal orientation and activates its associated content.

**`Home`**
Description: Moves focus to the first trigger and activates its associated content.

**`End`**
Description: Moves focus to the last trigger and activates its associated content.

**`Enter + Space`**
Description: In manual mode, when a trigger is focused, moves focus to its associated content.
