ant-design/components/button/demo/size.md

81 lines
2.2 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 2
title:
zh-CN: 按钮尺寸
en-US: Size
2016-03-31 09:40:55 +08:00
---
## zh-CN
2015-09-27 16:30:35 +08:00
按钮有大、中、小三种尺寸。
2015-06-07 14:03:00 +08:00
通过设置 `size``large` `small` 分别把按钮设为大、小尺寸。若不设置 `size`,则尺寸为中。
## 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-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.
2019-05-07 14:57:32 +08:00
```jsx
use ant design icons 4.0 (#18217) * feat: use @ant-design/icons@4.0 * feat: use createFromIconfontCN to make site works * feat: update doc for Icon * feat: use icon in component Alert * feat: use icon in component Avatar * feat: use icon in component Breadcrumb * feat: use icon in component Button * feat: use icon in component Cascader * feat: use icon in component Collapse * feat: use icon in component Datepicker * feat: use icon in component Dropdown * feat: use icon in component Form * feat: use icon in component Input * feat: use icon in component InputNumber * feat: use icon in component Layout * feat: use icon in component Mention * feat: use icon in component Message * feat: use icon in component Modal * feat: use icon in component Notification * feat: use icon in component PageHeader * feat: use icon in component Pagination * feat: use icon in component Popconfirm * feat: use icon in component Progress * feat: use icon in component Rate * feat: use icon in component Result * feat: use icon in component Select * feat: use icon in component Step * feat: use icon in component Switch * feat: use icon in component Table * feat: use icon in component Tab * feat: use icon in component Tag * feat: handle rest component which using Icon * fix: remove unused vars * feat: use latest alpha ant design icons * fix: failed test in uploadlist.test.js * test: update snapshot for icons * doc: add Icon for site * doc: use @ant-design/icons in site * chore: use latest icons * fix: tslint issue * fix: test cases * fix: types for react * fix: lint rules for import orders * fix: use @ant-design/icons@4.0.0-alpha.5 to avoid insert css in server render * fix: eslint error in demo/**.md * inject antd icons * update snapshot * fix site * doc: update docs * fix: code snippets icon in site * feat: use latest @ant-design/icons * fix: icon props in message
2019-08-13 14:07:17 +08:00
import { Button, Radio } from 'antd';
2019-11-29 14:27:47 +08:00
import { DownloadOutlined } from '@ant-design/icons';
class ButtonSize extends React.Component {
state = {
2017-09-11 15:17:48 +08:00
size: 'large',
};
2019-05-07 14:57:32 +08:00
handleSizeChange = e => {
this.setState({ size: e.target.value });
2019-05-07 14:57:32 +08:00
};
render() {
2019-06-19 19:09:08 +08:00
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>
</Radio.Group>
2019-05-07 14:57:32 +08:00
<br />
<br />
<Button type="primary" size={size}>
Primary
</Button>
2019-11-29 15:09:17 +08:00
<Button size={size}>Default</Button>
2019-05-07 14:57:32 +08:00
<Button type="dashed" size={size}>
Dashed
</Button>
2019-11-22 13:59:20 +08:00
<br />
2019-11-22 15:32:11 +08:00
<Button type="primary" danger size={size}>
2019-05-07 14:57:32 +08:00
Danger
</Button>
2019-11-22 15:32:11 +08:00
<Button danger size={size}>
2019-11-22 13:59:20 +08:00
Danger Default
2019-05-07 14:57:32 +08:00
</Button>
2019-11-22 15:32:11 +08:00
<Button danger type="link" size={size}>
2019-11-22 12:02:35 +08:00
Danger Link
</Button>
2019-11-22 13:59:20 +08:00
<Button type="link" size={size}>
Link
</Button>
2017-09-11 15:17:48 +08:00
<br />
<Button type="primary" icon={<DownloadOutlined />} size={size} />
<Button type="primary" shape="circle" icon={<DownloadOutlined />} size={size} />
<Button type="primary" shape="round" icon={<DownloadOutlined />} size={size} />
<Button type="primary" shape="round" icon={<DownloadOutlined />} size={size}>
2019-05-07 14:57:32 +08:00
Download
</Button>
<Button type="primary" icon={<DownloadOutlined />} size={size}>
2019-05-07 14:57:32 +08:00
Download
</Button>
</div>
);
}
}
ReactDOM.render(<ButtonSize />, mountNode);
2019-05-07 14:57:32 +08:00
```