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';
|
2022-07-04 22:09:54 +08:00
|
|
|
import type { SizeType } from 'antd/es/config-provider/SizeContext';
|
2022-05-23 14:37:16 +08:00
|
|
|
import React, { useState } from 'react';
|
2018-06-27 15:55:04 +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>
|
2022-08-05 10:49:08 +08:00
|
|
|
<Tabs
|
|
|
|
defaultActiveKey="1"
|
|
|
|
size={size}
|
|
|
|
style={{ marginBottom: 32 }}
|
|
|
|
items={new Array(3).fill(null).map((_, i) => {
|
|
|
|
const id = String(i + 1);
|
|
|
|
return {
|
|
|
|
label: `Tab ${id}`,
|
|
|
|
key: id,
|
|
|
|
children: `Content of tab ${id}`,
|
|
|
|
};
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
<Tabs
|
|
|
|
defaultActiveKey="1"
|
|
|
|
type="card"
|
|
|
|
size={size}
|
|
|
|
items={new Array(3).fill(null).map((_, i) => {
|
|
|
|
const id = String(i + 1);
|
|
|
|
return {
|
|
|
|
label: `Card Tab ${id}`,
|
|
|
|
key: id,
|
|
|
|
children: `Content of card tab ${id}`,
|
|
|
|
};
|
|
|
|
})}
|
|
|
|
/>
|
2022-05-19 09:46:26 +08:00
|
|
|
</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
|
|
|
```
|