2016-08-03 10:39:20 +08:00
|
|
|
---
|
|
|
|
category: Components
|
|
|
|
type: Navigation
|
2016-09-21 11:28:38 +08:00
|
|
|
title: Tabs
|
2016-08-03 10:39:20 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
Tabs make it easy to switch between different views.
|
|
|
|
|
2016-09-10 13:43:30 +08:00
|
|
|
### When To Use
|
2016-08-03 10:39:20 +08:00
|
|
|
|
|
|
|
Ant Design has 3 types Tabs for different situation.
|
|
|
|
|
|
|
|
- Card Tabs: for managing too many closeable views.
|
2016-09-01 18:12:12 +08:00
|
|
|
- Normal Tabs: for functional aspects of a page.
|
2016-11-06 15:45:39 +08:00
|
|
|
- [RadioButton](/components/radio/#components-radio-demo-radiobutton): for secondary tabs.
|
2016-08-03 10:39:20 +08:00
|
|
|
|
|
|
|
## API
|
|
|
|
|
|
|
|
### Tabs
|
|
|
|
|
|
|
|
| Property | Description | Type | Default |
|
|
|
|
|--------------|-----------------------|----------|--------------|
|
2016-10-09 14:26:41 +08:00
|
|
|
| activeKey | Current TabPane's key| string | _ |
|
2016-08-03 10:39:20 +08:00
|
|
|
| defaultActiveKey | Default actived tabPanel's key, if activeKey is not setted. | - |
|
|
|
|
| onChange | Callback when tab is switched | Function | - |
|
|
|
|
| onTabClick | Callback when tab is clicked | Function | - |
|
2016-10-09 14:26:41 +08:00
|
|
|
| tabBarExtraContent | Extra element in tab bar | React.ReactNode | - |
|
|
|
|
| type | Basic style of tabs. Options: line, card & editable-card | string | line |
|
2016-10-28 15:18:29 +08:00
|
|
|
| size | Tab bar size. Options: default, small. Only works while `type="line"`. | string | default |
|
2016-10-09 14:26:41 +08:00
|
|
|
| tabPosition | Position of tabs. Options: top, right, bottom & left | string | top |
|
|
|
|
| onEdit | Callback when tab is added or removed, which is executing when set type as editable-card | (targetKey, action): void | - |
|
|
|
|
| hideAdd | Hide plus icon or not, which is effective when set type as editable-card | boolean | false |
|
|
|
|
| animated | Whether to change tabs with animation, this property only works with `tabPosition=top|bottom` | boolean | true |
|
2016-08-03 10:39:20 +08:00
|
|
|
|
|
|
|
### Tabs.TabPane
|
|
|
|
| Property | Description | Type | Default |
|
|
|
|
|--------------|-----------------------|----------|--------------|
|
2016-10-09 14:26:41 +08:00
|
|
|
| key | TabPane's key | string | _ |
|
2017-01-20 20:10:50 +08:00
|
|
|
| tab | Show text in TabPane's head | string\|ReactNode | _ |
|