2020-03-22 11:38:02 +08:00
|
|
|
---
|
|
|
|
order: 2
|
|
|
|
title:
|
|
|
|
zh-CN: 间距大小
|
|
|
|
en-US: Space Size
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
间距预设大、中、小三种大小。
|
|
|
|
|
|
|
|
通过设置 `size` 为 `large` `middle` 分别把间距设为大、中间距。若不设置 `size`,则间距为小。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
`large`, `middle` and `small` preset sizes.
|
|
|
|
|
|
|
|
Set the size to `large` and `middle` by setting size to large and middle respectively. If `size` is not set, the spacing is `small`.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2022-05-21 22:14:15 +08:00
|
|
|
import { Button, Radio, Space } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import type { SpaceSize } from 'antd/es/space';
|
2020-03-22 11:38:02 +08:00
|
|
|
import React, { useState } from 'react';
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => {
|
|
|
|
const [size, setSize] = useState<SpaceSize | [SpaceSize, SpaceSize]>('small');
|
2020-03-22 11:38:02 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Radio.Group value={size} onChange={e => setSize(e.target.value)}>
|
|
|
|
<Radio value="small">Small</Radio>
|
|
|
|
<Radio value="middle">Middle</Radio>
|
|
|
|
<Radio value="large">Large</Radio>
|
|
|
|
</Radio.Group>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<Space size={size}>
|
|
|
|
<Button type="primary">Primary</Button>
|
|
|
|
<Button>Default</Button>
|
|
|
|
<Button type="dashed">Dashed</Button>
|
|
|
|
<Button type="link">Link</Button>
|
|
|
|
</Space>
|
|
|
|
</>
|
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
};
|
2020-03-22 11:38:02 +08:00
|
|
|
|
2022-04-28 20:54:19 +08:00
|
|
|
export default App;
|
2020-03-22 11:38:02 +08:00
|
|
|
```
|