mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 01:29:11 +08:00
48 lines
1.1 KiB
Markdown
48 lines
1.1 KiB
Markdown
---
|
|
order: 11
|
|
title:
|
|
zh-CN: 三种大小
|
|
en-US: Three Sizes
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
三种大小的输入框,若不设置,则为 `middle`。
|
|
|
|
## en-US
|
|
|
|
The input box comes in three sizes. `middle` will be used if `size` is omitted.
|
|
|
|
```tsx
|
|
import type { RadioChangeEvent } from 'antd';
|
|
import { DatePicker, Radio, Space } from 'antd';
|
|
import type { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
import React, { useState } from 'react';
|
|
|
|
const { RangePicker } = DatePicker;
|
|
|
|
const App: React.FC = () => {
|
|
const [size, setSize] = useState<SizeType>('middle');
|
|
|
|
const handleSizeChange = (e: RadioChangeEvent) => {
|
|
setSize(e.target.value);
|
|
};
|
|
|
|
return (
|
|
<Space direction="vertical" size={12}>
|
|
<Radio.Group value={size} onChange={handleSizeChange}>
|
|
<Radio.Button value="large">Large</Radio.Button>
|
|
<Radio.Button value="middle">middle</Radio.Button>
|
|
<Radio.Button value="small">Small</Radio.Button>
|
|
</Radio.Group>
|
|
<DatePicker size={size} />
|
|
<DatePicker size={size} picker="month" />
|
|
<RangePicker size={size} />
|
|
<DatePicker size={size} picker="week" />
|
|
</Space>
|
|
);
|
|
};
|
|
|
|
export default App;
|
|
```
|