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

105 lines
2.3 KiB
Markdown
Raw Normal View History

2015-06-17 18:22:20 +08:00
# 按钮组合
2015-09-27 16:30:35 +08:00
- order: 5
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>
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>
<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
<h4>带图标按钮组合</h4>
2015-09-27 16:30:35 +08:00
<ButtonGroup>
<Button type="primary">
<Icon type="left" />
2015-09-27 16:30:35 +08:00
<span>后退</span>
</Button>
<Button type="primary">
前进
<Icon type="right" />
2015-09-27 16:30:35 +08:00
</Button>
</ButtonGroup>
<ButtonGroup>
<Button type="primary">
<Icon type="cloud" />
2015-09-27 16:30:35 +08:00
</Button>
<Button type="primary">
<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>
<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>
<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>
<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>
, 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>