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
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
|
|
|
import type { RadioChangeEvent } from 'antd';
|
2022-05-23 14:37:16 +08:00
|
|
|
import { Radio, Tabs } from 'antd';
|
|
|
|
import type { SizeType } from 'antd/lib/config-provider/SizeContext';
|
|
|
|
import React, { useState } from 'react';
|
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
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => {
|
|
|
|
const [size, setSize] = useState<SizeType>('small');
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const onChange = (e: RadioChangeEvent) => {
|
|
|
|
setSize(e.target.value);
|
2019-05-07 14:57:32 +08:00
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Radio.Group value={size} onChange={onChange} style={{ marginBottom: 16 }}>
|
|
|
|
<Radio.Button value="small">Small</Radio.Button>
|
|
|
|
<Radio.Button value="middle">Middle</Radio.Button>
|
|
|
|
<Radio.Button value="large">Large</Radio.Button>
|
|
|
|
</Radio.Group>
|
|
|
|
<Tabs defaultActiveKey="1" size={size} style={{ marginBottom: 32 }}>
|
|
|
|
<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>
|
|
|
|
</Tabs>
|
|
|
|
<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>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
2017-10-18 21:17:18 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|