2015-06-17 18:22:20 +08:00
|
|
|
# 按钮组合
|
2015-06-05 20:26:41 +08:00
|
|
|
|
2015-09-27 16:30:35 +08:00
|
|
|
- order: 5
|
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>
|
2015-06-08 12:32:09 +08:00
|
|
|
<h4>基本组合</h4>
|
2015-09-27 16:30:35 +08:00
|
|
|
<ButtonGroup>
|
2016-01-28 14:23:09 +08:00
|
|
|
<Button type="primary">确定</Button>
|
|
|
|
<Button type="primary">取消</Button>
|
2015-09-27 16:30:35 +08:00
|
|
|
</ButtonGroup>
|
|
|
|
<ButtonGroup>
|
2016-01-25 21:06:32 +08:00
|
|
|
<Button disabled>左</Button>
|
|
|
|
<Button disabled>中</Button>
|
|
|
|
<Button disabled>右</Button>
|
2015-09-27 16:30:35 +08:00
|
|
|
</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
|
|
|
|
2015-10-28 20:55:49 +08:00
|
|
|
<h4>带图标按钮组合</h4>
|
2015-09-27 16:30:35 +08:00
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="primary">
|
2015-10-02 15:04:28 +08:00
|
|
|
<Icon type="left" />
|
2015-09-27 16:30:35 +08:00
|
|
|
<span>后退</span>
|
|
|
|
</Button>
|
|
|
|
<Button type="primary">
|
|
|
|
前进
|
2015-10-02 15:04:28 +08:00
|
|
|
<Icon type="right" />
|
2015-09-27 16:30:35 +08:00
|
|
|
</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="primary">
|
2015-10-02 15:04:28 +08:00
|
|
|
<Icon type="cloud" />
|
2015-09-27 16:30:35 +08:00
|
|
|
</Button>
|
|
|
|
<Button type="primary">
|
2015-10-02 15:04:28 +08:00
|
|
|
<Icon type="cloud-download" />
|
2015-09-27 16:30:35 +08:00
|
|
|
</Button>
|
|
|
|
</ButtonGroup>
|
2015-10-06 12:55:01 +08:00
|
|
|
|
2015-06-08 12:32:09 +08:00
|
|
|
<h4>多个组合</h4>
|
2015-09-27 16:30:35 +08:00
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="ghost">1</Button>
|
|
|
|
<Button type="ghost">2</Button>
|
|
|
|
<Button type="ghost">3</Button>
|
|
|
|
<Button type="ghost">4</Button>
|
|
|
|
<Button type="ghost">
|
|
|
|
<span>前进</span>
|
2015-10-02 15:04:28 +08:00
|
|
|
<Icon type="right" />
|
2015-09-27 16:30:35 +08:00
|
|
|
</Button>
|
|
|
|
</ButtonGroup>
|
2015-10-06 12:55:01 +08:00
|
|
|
|
2015-06-08 12:32:09 +08:00
|
|
|
<h4>尺寸</h4>
|
2015-10-22 21:01:52 +08:00
|
|
|
<ButtonGroup size="large">
|
2015-09-27 16:30:35 +08:00
|
|
|
<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>
|
2015-10-22 21:01:52 +08:00
|
|
|
<ButtonGroup size="small">
|
2015-09-27 16:30:35 +08:00
|
|
|
<Button type="ghost">小</Button>
|
|
|
|
<Button type="ghost">小</Button>
|
|
|
|
<Button type="ghost">小</Button>
|
|
|
|
</ButtonGroup>
|
2015-06-08 12:32:09 +08:00
|
|
|
</div>
|
2015-12-29 12:08:58 +08:00
|
|
|
, 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>
|