2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 5
|
2016-09-01 18:12:12 +08:00
|
|
|
title:
|
2017-10-18 21:17:18 +08:00
|
|
|
zh-CN: 大小
|
|
|
|
en-US: Size
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-06-19 17:26:24 +08:00
|
|
|
|
2016-08-03 10:39:20 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2017-10-18 21:17:18 +08:00
|
|
|
大号页签用在页头区域,小号用在弹出框等较狭窄的容器内。
|
2015-06-19 17:26:24 +08:00
|
|
|
|
2016-08-03 10:39:20 +08:00
|
|
|
## en-US
|
|
|
|
|
2019-08-07 17:26:39 +08:00
|
|
|
Large size tabs are usually used in page header, and small size could be used in Modal.
|
2016-08-03 10:39:20 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```jsx
|
2017-10-18 21:17:18 +08:00
|
|
|
import { Tabs, Radio } from 'antd';
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2017-10-18 21:17:18 +08:00
|
|
|
const { TabPane } = Tabs;
|
2015-06-19 17:26:24 +08:00
|
|
|
|
2017-10-18 21:17:18 +08:00
|
|
|
class Demo extends React.Component {
|
|
|
|
state = { size: 'small' };
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
onChange = e => {
|
2017-10-18 21:17:18 +08:00
|
|
|
this.setState({ size: e.target.value });
|
2019-05-07 14:57:32 +08:00
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2017-10-18 21:17:18 +08:00
|
|
|
render() {
|
|
|
|
const { size } = this.state;
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Radio.Group value={size} onChange={this.onChange} style={{ marginBottom: 16 }}>
|
|
|
|
<Radio.Button value="small">Small</Radio.Button>
|
|
|
|
<Radio.Button value="default">Default</Radio.Button>
|
|
|
|
<Radio.Button value="large">Large</Radio.Button>
|
|
|
|
</Radio.Group>
|
2020-04-01 10:54:38 +08:00
|
|
|
<Tabs defaultActiveKey="1" size={size} style={{ marginBottom: 32 }}>
|
2019-05-07 14:57:32 +08:00
|
|
|
<TabPane tab="Tab 1" key="1">
|
|
|
|
Content of tab 1
|
|
|
|
</TabPane>
|
|
|
|
<TabPane tab="Tab 2" key="2">
|
|
|
|
Content of tab 2
|
|
|
|
</TabPane>
|
|
|
|
<TabPane tab="Tab 3" key="3">
|
|
|
|
Content of tab 3
|
|
|
|
</TabPane>
|
2017-10-18 21:17:18 +08:00
|
|
|
</Tabs>
|
2020-04-01 10:54:38 +08:00
|
|
|
<Tabs defaultActiveKey="1" type="card" size={size}>
|
|
|
|
<TabPane tab="Card Tab 1" key="1">
|
|
|
|
Content of card tab 1
|
|
|
|
</TabPane>
|
|
|
|
<TabPane tab="Card Tab 2" key="2">
|
|
|
|
Content of card tab 2
|
|
|
|
</TabPane>
|
|
|
|
<TabPane tab="Card Tab 3" key="3">
|
|
|
|
Content of card tab 3
|
|
|
|
</TabPane>
|
|
|
|
</Tabs>
|
2017-10-18 21:17:18 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(<Demo />, mountNode);
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|