mirror of
https://github.com/wahyd4/ant-design.git
synced 2026-08-13 14:56:27 +10:00
* css: fix icon size in button, close: #4023 * test: update snapshot for Button demo
1.6 KiB
1.6 KiB
order, title
| order | title | ||||
|---|---|---|---|---|---|
| 2 |
|
zh-CN
按钮有大、中、小三种尺寸。
通过设置 size 为 large small 分别把按钮设为大、小尺寸。若不设置 size,则尺寸为中。
en-US
Ant Design supports a default button size as well as a large and small size.
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.
import { Button, Radio, Icon } from 'antd';
class ButtonSize extends React.Component {
state = {
size: 'default',
};
handleSizeChange = (e) => {
this.setState({ size: e.target.value });
}
render() {
const size = this.state.size;
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>
<br /><br />
<Button type="primary" shape="circle" icon="download" size={size} />
<Button type="primary" icon="download" size={size}>Download</Button>
<Button type="primary" size={size}>Normal</Button>
<br />
<Button.Group size={size}>
<Button type="primary">
<Icon type="left" />Backward
</Button>
<Button type="primary">
Forward<Icon type="right" />
</Button>
</Button.Group>
</div>
);
}
}
ReactDOM.render(<ButtonSize />, mountNode);