# @rc-component/tabs

> Tabs UI component for React

Latest version **2.1.0** (published 2026-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rc-component/tabs
pnpm add @rc-component/tabs
yarn add @rc-component/tabs
bun add @rc-component/tabs
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2026-09-11 |
| First published | 2025-02-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8.x |
| Dependencies | 6 |
| Unpacked size | 161.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 572 |
| Author | yiminghe@gmail.com |
| Maintainers | zombiej, afc163, madccc, peachscript, chenshuai2144 |
| Keywords | react, react-component, react-tabs |

## Links

- npm: https://www.npmjs.com/package/@rc-component/tabs
- Repository: https://github.com/react-component/tabs
- Homepage: https://react-component.github.io/tabs
- Issues: https://github.com/react-component/tabs/issues
- npm.io page: https://npm.io/package/@rc-component/tabs

## Dependencies (6)

- [clsx](https://npm.io/package/clsx.md) ^2.1.1
- [@rc-component/menu](https://npm.io/package/@rc-component/menu.md) ~1.6.0
- [@rc-component/util](https://npm.io/package/@rc-component/util.md) ^1.13.0
- [@rc-component/motion](https://npm.io/package/@rc-component/motion.md) ^1.1.3
- [@rc-component/dropdown](https://npm.io/package/@rc-component/dropdown.md) ~2.0.0
- [@rc-component/resize-observer](https://npm.io/package/@rc-component/resize-observer.md) ^1.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.1.0 (latest) — 2026-09-11
- 2.0.0 — 2026-09-09
- 1.14.0 — 2026-09-01
- 1.13.0 — 2026-08-19
- 1.12.0 — 2026-07-09
- 1.11.0 — 2026-06-26
- 1.10.0 — 2026-06-01
- 1.9.1 — 2026-05-27
- 1.9.0 — 2026-05-06
- 1.8.0 — 2026-03-11
- 1.7.0 — 2025-12-04
- 1.6.0 — 2025-10-14
- 1.5.2 — 2025-09-08
- 1.5.1 — 2025-07-25
- 1.5.0 — 2025-05-06
- … 7 more at https://npm.io/package/@rc-component/tabs/versions

## README

<div align="center">
  <h1>@rc-component/tabs</h1>
  <p><sub><a href="https://ant.design"><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /></a> Part of the Ant Design ecosystem.</sub></p>
  <p>📑 Flexible React tabs with overflow, editable items, custom tab bars, and accessible panels.</p>

  <p>
    <a href="https://npmjs.org/package/@rc-component/tabs"><img alt="NPM version" src="https://img.shields.io/npm/v/@rc-component/tabs.svg?style=flat-square"></a>
    <a href="https://npmjs.org/package/@rc-component/tabs"><img alt="npm downloads" src="https://img.shields.io/npm/dm/@rc-component/tabs.svg?style=flat-square"></a>
    <a href="https://github.com/react-component/tabs/actions/workflows/react-component-ci.yml"><img alt="build status" src="https://github.com/react-component/tabs/actions/workflows/react-component-ci.yml/badge.svg"></a>
    <a href="https://app.codecov.io/gh/react-component/tabs"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/react-component/tabs/master.svg?style=flat-square"></a>
    <a href="https://bundlephobia.com/package/@rc-component/tabs"><img alt="bundle size" src="https://img.shields.io/bundlephobia/minzip/@rc-component/tabs?style=flat-square"></a>
    <a href="https://github.com/umijs/dumi"><img alt="dumi" src="https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square"></a>
  </p>
</div>

<p align="center">English | <a href="./README.zh-CN.md">简体中文</a></p>

## Highlights

- Supports top, bottom, left, and right tab positions with RTL layouts.
- Handles overflow with a dropdown operation menu.
- Supports editable tabs, extra tab bar content, indicators, and custom tab bars.
- Provides semantic `classNames` and `styles` slots for panel and navigation customization.

## Install

```bash
npm install @rc-component/tabs
```

## Usage

```tsx pure
import Tabs from '@rc-component/tabs';
import '@rc-component/tabs/assets/index.css';

const items = [
  { key: 'overview', label: 'Overview', children: 'Overview content' },
  { key: 'settings', label: 'Settings', children: 'Settings content' },
];

export default () => <Tabs items={items} defaultActiveKey="overview" />;
```

Online preview: https://tabs.react-component.vercel.app/

## Examples

Run the local dumi site:

```bash
npm install
npm start
```

Then open `http://localhost:8000`.

## API

### Tabs

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `activeKey` | string | - | Controlled active tab key. |
| `animated` | boolean \| AnimatedConfig | `{ inkBar: true, tabPane: false }` | Animation config. |
| `className` | string | - | Additional class name. |
| `classNames` | `Partial<Record<SemanticName, string>>` | - | Semantic class names. |
| `defaultActiveKey` | string | - | Initial active tab key. |
| `destroyOnHidden` | boolean | false | Destroy inactive tab panels. |
| `direction` | `'ltr' \| 'rtl'` | `'ltr'` | Layout direction. |
| `editable` | EditableConfig | - | Editable tab configuration. |
| `getPopupContainer` | `(node: HTMLElement) => HTMLElement` | - | Popup container resolver. |
| `id` | string | - | Root id. |
| `indicator` | `{ size?: GetIndicatorSize; align?: 'start' \| 'center' \| 'end' }` | - | Indicator size and alignment. |
| `items` | Tab[] | [] | Tab items. |
| `locale` | TabsLocale | - | Accessibility locale text. |
| `more` | MoreProps | - | more dropdown config, see [MoreProps](#moreprops) for full API. Additionally supports `popupRender` for custom popup content. |
| `onChange` | `(activeKey: string) => void` | - | Triggered when active tab changes. |
| `onTabClick` | `(activeKey, event) => void` | - | Triggered when a tab is clicked. |
| `onTabScroll` | `({ direction }) => void` | - | Triggered when tab navigation scrolls. |
| `prefixCls` | string | `'rc-tabs'` | Prefix class name. |
| `renderTabBar` | RenderTabBar | - | Custom tab bar renderer. |
| `style` | React.CSSProperties | - | Root style. |
| `styles` | `Partial<Record<SemanticName, React.CSSProperties>>` | - | Semantic styles. |
| `tabBarExtraContent` | React.ReactNode \| TabBarExtraMap | - | Extra content beside the tab bar. |
| `tabBarGutter` | number | 0 | Gap between tabs. |
| `tabBarStyle` | React.CSSProperties | - | Tab bar style. |
| `tabPosition` | `'left' \| 'right' \| 'top' \| 'bottom'` | `'top'` | Tab position. |

### Tab

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | React.ReactNode | - | Tab panel content. |
| `className` | string | - | Panel class name. |
| `closable` | boolean | - | Whether the tab can be closed in editable mode. |
| `closeIcon` | React.ReactNode | - | Custom close icon. |
| `destroyOnHidden` | boolean | false | Destroy inactive panel. |
| `disabled` | boolean | false | Disable the tab. |
| `forceRender` | boolean | false | Render panel before it becomes active. |
| `key` | string | - | Required unique tab key. |
| `label` | React.ReactNode | - | Tab label. |
| `style` | React.CSSProperties | - | Panel style. |

### MoreProps

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `icon` | ReactNode | - | The icon shown in the more trigger. |
| `popupRender` | `(menu: ReactElement, info: { restTabs: Tab[], onClose: () => void }) => ReactElement` | - | Customize the dropdown popup content. The `info` object provides `restTabs` (all overflowed tabs) and `onClose` (function to close the dropdown). |
| Other dropdown props | from DropdownProps | - | All other [rc-dropdown](https://github.com/react-component/dropdown) props such as `trigger`, `overlayClassName`, `open`, etc. are also supported. |

Dropdown 2 uses `more.open` and `more.onOpenChange`. The previous `more.visible` and `more.onVisibleChange` props are no longer supported and must be migrated when upgrading.

## Development

```bash
npm install
npm start
npm test
npm run tsc
npm run compile
npm run build
```

The dumi site runs at `http://localhost:8000` by default.

## Release

```bash
npm run prepublishOnly
```

The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build.

## License

@rc-component/tabs is released under the [MIT](./LICENSE) license.

---
_Source: https://npm.io/package/@rc-component/tabs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
