ant-design/components/date-picker/demo/size.md

52 lines
1.1 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 2
title:
2016-06-19 11:17:09 +08:00
zh-CN: 三种大小
en-US: Three Sizes
2016-03-31 09:40:55 +08:00
---
2016-06-19 11:17:09 +08:00
## zh-CN
三种大小的输入框,若不设置,则为 `default`
2016-06-19 11:17:09 +08:00
## en-US
The input box comes in three sizes. `default` will be used if `size` is omitted.
2016-06-19 11:17:09 +08:00
2017-02-13 10:55:53 +08:00
````jsx
import { DatePicker, Radio } from 'antd';
const { MonthPicker, RangePicker } = DatePicker;
class PickerSizesDemo extends React.Component {
state = {
size: 'default',
};
handleSizeChange = (e) => {
this.setState({ size: e.target.value });
}
render() {
const { size } = this.state;
return (
<div>
<Radio.Group value={size} onChange={this.handleSizeChange}>
<Radio.Button value="large">Large</Radio.Button>
<Radio.Button value="default">Default</Radio.Button>
<Radio.Button value="small">Small</Radio.Button>
2016-11-14 19:13:37 +08:00
</Radio.Group>
<br /><br />
<DatePicker size={size} />
<br />
<MonthPicker size={size} />
<br />
<RangePicker size={size} />
</div>
);
}
}
ReactDOM.render(<PickerSizesDemo />, mountNode);
````