ant-design/components/button/demo/button-group.md
偏右 f850993fda More types of Button (#4679)
* Add Button[ghost] property, close #4625

* Add danger button

close #1308

* update API doc about ghost and danger property
2017-01-23 22:24:36 +08:00

1.7 KiB

order title
6
zh-CN en-US
按钮组合 Button Group

zh-CN

可以将多个 Button 放入 Button.Group 的容器中。

通过设置 sizelarge small 分别把按钮组合设为大、小尺寸。若不设置 size,则尺寸为中。

en-US

Buttons can be grouped by placing multiple Button components into a Button.Group.

The size can be set to large, small or left unset resulting in a default size.

import { Button, Icon } from 'antd';
const ButtonGroup = Button.Group;

ReactDOM.render(
  <div>
    <h4>Basic</h4>
    <ButtonGroup>
      <Button>Cancel</Button>
      <Button type="primary">OK</Button>
    </ButtonGroup>
    <ButtonGroup>
      <Button disabled>L</Button>
      <Button disabled>M</Button>
      <Button disabled>R</Button>
    </ButtonGroup>
    <ButtonGroup>
      <Button type="primary">L</Button>
      <Button>M</Button>
      <Button type="ghost">M</Button>
      <Button type="dashed">R</Button>
    </ButtonGroup>

    <h4>With Icon</h4>
    <ButtonGroup>
      <Button type="primary">
        <Icon type="left" />Go back
      </Button>
      <Button type="primary">
        Go forward<Icon type="right" />
      </Button>
    </ButtonGroup>
    <ButtonGroup>
      <Button type="primary" icon="cloud" />
      <Button type="primary" icon="cloud-download" />
    </ButtonGroup>
  </div>,
  mountNode
);