2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 5
|
|
|
|
title: 按钮组合
|
|
|
|
---
|
2015-06-05 20:26:41 +08:00
|
|
|
|
2015-11-03 14:25:36 +08:00
|
|
|
可以将多个 `Button` 放入 `Button.Group` 的容器中。
|
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
|
|
|
|
2015-10-02 15:04:28 +08:00
|
|
|
````jsx
|
2015-11-03 14:25:36 +08:00
|
|
|
import { Button, Icon } from 'antd';
|
|
|
|
const ButtonGroup = Button.Group;
|
2015-10-02 15:04:28 +08:00
|
|
|
|
2015-10-20 16:47:55 +08:00
|
|
|
ReactDOM.render(<div>
|
2016-04-29 12:13:27 +08:00
|
|
|
<h4>基本组合</h4>
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="primary">确定</Button>
|
|
|
|
<Button type="primary">取消</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button disabled>左</Button>
|
|
|
|
<Button disabled>中</Button>
|
|
|
|
<Button disabled>右</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="primary">左</Button>
|
|
|
|
<Button type="ghost">中</Button>
|
|
|
|
<Button type="ghost">中</Button>
|
|
|
|
<Button>右</Button>
|
|
|
|
</ButtonGroup>
|
2015-10-06 12:55:01 +08:00
|
|
|
|
2016-04-29 12:13:27 +08:00
|
|
|
<h4>带图标按钮组合</h4>
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="primary">
|
|
|
|
<Icon type="left" />后退
|
|
|
|
</Button>
|
|
|
|
<Button type="primary">
|
|
|
|
前进<Icon type="right" />
|
|
|
|
</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="primary" icon="cloud" />
|
|
|
|
<Button type="primary" icon="cloud-download" />
|
|
|
|
</ButtonGroup>
|
2015-10-06 12:55:01 +08:00
|
|
|
|
2016-04-29 12:13:27 +08:00
|
|
|
<h4>尺寸</h4>
|
|
|
|
<ButtonGroup size="large">
|
|
|
|
<Button type="ghost">大</Button>
|
|
|
|
<Button type="ghost">大</Button>
|
|
|
|
<Button type="ghost">大</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="ghost">默认</Button>
|
|
|
|
<Button type="ghost">默认</Button>
|
|
|
|
<Button type="ghost">默认</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
<ButtonGroup size="small">
|
|
|
|
<Button type="ghost">小</Button>
|
|
|
|
<Button type="ghost">小</Button>
|
|
|
|
<Button type="ghost">小</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
</div>, mountNode);
|
2015-06-08 12:32:09 +08:00
|
|
|
````
|
|
|
|
|
|
|
|
<style>
|
2015-10-30 17:04:22 +08:00
|
|
|
#components-button-demo-button-group h4 {
|
|
|
|
margin: 16px 0;
|
|
|
|
font-size: 14px;
|
|
|
|
line-height: 1;
|
2015-06-15 22:14:15 +08:00
|
|
|
font-weight: normal;
|
2015-06-15 19:33:39 +08:00
|
|
|
}
|
2015-10-30 17:04:22 +08:00
|
|
|
#components-button-demo-button-group h4:first-child {
|
2015-06-08 12:32:09 +08:00
|
|
|
margin-top: 0;
|
|
|
|
}
|
2015-10-30 17:04:22 +08:00
|
|
|
#components-button-demo-button-group .ant-btn {
|
2015-06-15 19:33:39 +08:00
|
|
|
margin-bottom: 8px;
|
2015-06-09 15:21:07 +08:00
|
|
|
}
|
2015-09-27 16:30:35 +08:00
|
|
|
#components-button-demo-button-group .ant-btn-group {
|
|
|
|
margin-right: 8px;
|
|
|
|
}
|
|
|
|
#components-button-demo-button-group .ant-btn {
|
|
|
|
margin-bottom: 12px;
|
2015-10-02 15:04:28 +08:00
|
|
|
}
|
2015-06-08 12:32:09 +08:00
|
|
|
</style>
|