2016-03-31 09:40:55 +08:00
---
order: 2
2016-04-22 14:52:19 +08:00
title:
zh-CN: 按钮尺寸
en-US: Size
2016-03-31 09:40:55 +08:00
---
2015-06-05 20:26:41 +08:00
2016-04-22 14:52:19 +08:00
## zh-CN
2015-09-27 16:30:35 +08:00
按钮有大、中、小三种尺寸。
2015-06-07 14:03:00 +08:00
2015-10-22 21:01:52 +08:00
通过设置 `size` 为 `large` `small` 分别把按钮设为大、小尺寸。若不设置 `size` ,则尺寸为中。
2015-06-05 20:26:41 +08:00
2016-04-22 14:52:19 +08:00
## en-US
2016-04-25 11:04:56 +08:00
Ant Design supports a default button size as well as a large and small size.
2016-04-22 14:52:19 +08:00
2016-04-25 11:04:56 +08:00
If a large or small button is desired, set the `size` property to either `large` or `small` respectively. Omit the `size` property for a button with the default size.
2016-04-22 14:52:19 +08:00
2019-05-07 14:57:32 +08:00
```jsx
2019-08-13 14:07:17 +08:00
import { Button, Radio } from 'antd';
import { Download, Left, Right } from '@ant-design/icons';
2016-12-02 15:06:59 +08:00
class ButtonSize extends React.Component {
state = {
2017-09-11 15:17:48 +08:00
size: 'large',
2016-12-02 15:06:59 +08:00
};
2019-05-07 14:57:32 +08:00
handleSizeChange = e => {
2016-12-02 15:06:59 +08:00
this.setState({ size: e.target.value });
2019-05-07 14:57:32 +08:00
};
2016-12-02 15:06:59 +08:00
render() {
2019-06-19 19:09:08 +08:00
const { size } = this.state;
2016-12-02 15:06:59 +08:00
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 >
< / Radio.Group >
2019-05-07 14:57:32 +08:00
< br / >
< br / >
< Button type = "primary" size = {size} >
Primary
< / Button >
2017-09-11 15:17:48 +08:00
< Button size = {size} > Normal< / Button >
2019-05-07 14:57:32 +08:00
< Button type = "dashed" size = {size} >
Dashed
< / Button >
< Button type = "danger" size = {size} >
Danger
< / Button >
< Button type = "link" size = {size} >
Link
< / Button >
2017-09-11 15:17:48 +08:00
< br / >
2019-08-29 23:41:46 +08:00
< Button type = "primary" icon = {<Download / > } size={size} />
2019-08-13 14:07:17 +08:00
< Button type = "primary" shape = "circle" icon = {<Download / > } size={size} />
2019-08-29 23:41:46 +08:00
< Button type = "primary" shape = "round" icon = {<Download / > } size={size} />
2019-08-13 14:07:17 +08:00
< Button type = "primary" shape = "round" icon = {<Download / > } size={size}>
2019-05-07 14:57:32 +08:00
Download
< / Button >
2019-08-13 14:07:17 +08:00
< Button type = "primary" icon = {<Download / > } size={size}>
2019-05-07 14:57:32 +08:00
Download
< / Button >
2016-12-02 15:06:59 +08:00
< br / >
< Button.Group size = {size} >
< Button type = "primary" >
2019-08-13 14:07:17 +08:00
< Left / >
2019-05-07 14:57:32 +08:00
Backward
2016-12-02 15:06:59 +08:00
< / Button >
< Button type = "primary" >
2019-05-07 14:57:32 +08:00
Forward
2019-08-13 14:07:17 +08:00
< Right / >
2016-12-02 15:06:59 +08:00
< / Button >
< / Button.Group >
< / div >
);
}
}
ReactDOM.render(< ButtonSize / > , mountNode);
2019-05-07 14:57:32 +08:00
```