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

85 lines
2.0 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 5
title: 按钮组合
---
2015-11-03 14:25:36 +08:00
可以将多个 `Button` 放入 `Button.Group` 的容器中。
2015-06-07 14:03:00 +08:00
通过设置 `size``large` `small` 分别把按钮组合设为大、小尺寸。若不设置 `size`,则尺寸为中。
````jsx
2015-11-03 14:25:36 +08:00
import { Button, Icon } from 'antd';
const ButtonGroup = Button.Group;
2015-10-20 16:47:55 +08:00
ReactDOM.render(<div>
<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
<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
<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-06-08 12:32:09 +08:00
</style>