基于React、Ant Design的ButtonGroup组件

23 篇文章 18 订阅
12 篇文章 0 订阅

目录

介绍

使用方式

安装

使用

API

Props

children


介绍

  1. 本组件基于ReactAnt Design,适用于React + Ant Design项目

  2. 本组件设计为超过一定数量的按钮将展示在Dropdown

使用方式

安装

npm i antd-button-group

使用

import ButtonGroup from 'antd-button-group'
<ButtonGroup>
  <Button size='small' type='link' onClick={() => message.success('编辑')}>编辑</Button>
  <Button size='small' type='link' danger onClick={() => message.warning('删除')}>删除</Button>
  <Button size='small' type='link' onClick={() => message.success('随便什么操作')}>随便什么操作</Button>
  <Button type='primary' onClick={() => message.success('primary to link')}>primary to link</Button>
  <Button size='small' type='link' danger onClick={() => message.error('按钮 danger')}>按钮 danger</Button>
  <Menu.Divider />
  <a onClick={() => message.success('a标签')}>a标签</a>
</ButtonGroup>

API

Props

属性说明类型默认值可选值
max外部显示几个按钮,其余放在Dropdown中Number|String2
placementDropdown弹出位置StringbottomLeftbottomLeftbottomCenterbottomRight topLefttopCentertopRight
arrowDropdown下拉框箭头是否显示Booleanfalse
trigger触发下拉的行为, 移动端不支持 hoverArray|StringclickclickhovercontextMenu
icon右侧更多 iconPropTypes.elementTypeAntd Icon MoreOutlined
iconStyle右侧更多 icon 样式Object{ fontSize: 16, verticalAlign: 'middle', marginLeft: 2 }
children按钮PropTypes.node-

children

PropTypes.node说明
<Button type='primary'>按钮</Button>Dropdown中的Button将会自动转为<Button type='link'>按钮</Button>
<Menu.Divider />使用该组件渲染分割线

<Button type='link' disabled>按钮</Button>

<a disabled onClick={() => message.success('a标签')}>a标签</a>

disabled不可用

欢迎点赞、评论、MR  (*^▽^*)

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

__畫戟__

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值