rc-tabs
tabs ui component for react
Last updated 5 years ago by zombiej .
MIT · Repository · Bugs · Original npm
$ cnpm install rc-tabs 
SYNC missed versions from official npm registry.

rc-tabs


React Tabs

NPM version build status Test coverage gemnasium deps npm download

Screenshot

Example

http://localhost:8000/examples

online example: http://react-component.github.io/tabs/

install

rc-tabs

Feature

Keyboard

  • left and up: switch to previous tab
  • right and down: switch to next tab

Usage

import Tabs, { TabPane } from 'rc-tabs';
import TabContent from 'rc-tabs/lib/TabContent';
import ScrollableInkTabBar from 'rc-tabs/lib/ScrollableInkTabBar';

var callback = function(key) {};

React.render(
  <Tabs defaultActiveKey="2" onChange={callback}>
    <TabPane tab="tab 1" key="1">
      first
    </TabPane>
    <TabPane tab="tab 2" key="2">
      second
    </TabPane>
    <TabPane tab="tab 3" key="3">
      third
    </TabPane>
  </Tabs>,
  document.getElementById('t2'),
);

API

Tabs

name type default description
activeKey string - current active tabPanel's key
animated boolean | { inkBar: boolean, tabPane: boolean } true config animation
defaultActiveKey string - initial active tabPanel's key if activeKey is absent
destroyInactiveTabPane 'ltr' | 'rlt' 'ltr' Layout direction of tabs component
direction boolean false whether destroy inactive TabPane when change tab
editable { onEdit(type: 'add' 'remove', info: { key, event }), showAdd: boolean, removeIcon: ReactNode, addIcon: ReactNode } -
locale { dropdownAriaLabel: string, removeAriaLabel: string, addAriaLabel: string } - Accessibility locale help text
moreIcon ReactNode - collapse icon
tabBarGutter number 0 config tab bar gutter
tabBarPosition 'left' | 'right' | 'top' | 'bottom' 'top' tab nav 's position
tabBarStyle style - tab nav style
tabBarExtraContent ReactNode - config extra content
renderTabBar (props, TabBarComponent) => ReactElement - How to render tab bar
prefixCls string 'rc-tabs' prefix class name, use to custom style
onChange (key) => void - called when tabPanel is changed
onTabClick (key) => void - called when tab click
onTabScroll ({ direction }) => void - called when tab scroll

TabPane

name type default description
key string - corresponding to activeKey, should be unique
forceRender boolean false forced render of content in tabs, not lazy render after clicking on tabs
tab ReactNode - current tab's title corresponding to current tabPane
closeIcon ReactNode - Config close icon

Development

npm install
npm start

Test Case

npm test
npm run chrome-test

Coverage

npm run coverage

open coverage/ dir

License

rc-tabs is released under the MIT license.

Current Tags

  • 10.0.0-alpha.1                                ...           beta (6 years ago)
  • 12.5.6                                ...           latest (3 years ago)

37 Versions

  • 12.5.6                                ...           3 years ago
  • 12.3.0                                ...           3 years ago
  • 12.2.1                                ...           3 years ago
  • 12.1.0-alpha.1                                ...           3 years ago
  • 11.16.1                                ...           3 years ago
  • 9.1.4                                ...           8 years ago
  • 11.14.1                                ...           3 years ago
  • 11.13.0                                ...           3 years ago
  • 11.12.0                                ...           3 years ago
  • 11.11.0                                ...           3 years ago
  • 11.10.8                                ...           3 years ago
  • 11.8.0                                ...           4 years ago
  • 11.10.1                                ...           4 years ago
  • 11.7.3                                ...           5 years ago
  • 11.7.2                                ...           5 years ago
  • 11.6.2                                ...           5 years ago
  • 7.5.0                                ...           8 years ago
  • 11.5.6                                ...           5 years ago
  • 9.2.6                                ...           7 years ago
  • 11.4.1                                ...           5 years ago
  • 11.3.1                                ...           5 years ago
  • 11.2.4                                ...           5 years ago
  • 10.0.0                                ...           6 years ago
  • 10.0.0-alpha.1                                ...           6 years ago
  • 5.5.2                                ...           10 years ago
  • 8.0.0                                ...           8 years ago
  • 9.5.8                                ...           7 years ago
  • 8.0.2                                ...           8 years ago
  • 9.0.4                                ...           8 years ago
  • 7.2.0                                ...           8 years ago
  • 9.7.0                                ...           6 years ago
  • 5.9.3                                ...           9 years ago
  • 7.1.1                                ...           9 years ago
  • 9.1.11                                ...           8 years ago
  • 7.3.4                                ...           8 years ago
  • 10.1.1                                ...           5 years ago
  • 9.6.7                                ...           6 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (8)
Dev Dependencies (31)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org