ant-design/components/button/index.zh-CN.md
vagusX 149729e524
use ant design icons 4.0 (#18217)
* feat: use @ant-design/icons@4.0

* feat: use createFromIconfontCN to make site works

* feat: update doc for Icon

* feat: use icon in component Alert

* feat: use icon in component Avatar

* feat: use icon in component Breadcrumb

* feat: use icon in component Button

* feat: use icon in component Cascader

* feat: use icon in component Collapse

* feat: use icon in component Datepicker

* feat: use icon in component Dropdown

* feat: use icon in component Form

* feat: use icon in component Input

* feat: use icon in component InputNumber

* feat: use icon in component Layout

* feat: use icon in component Mention

* feat: use icon in component Message

* feat: use icon in component Modal

* feat: use icon in component Notification

* feat: use icon in component PageHeader

* feat: use icon in component Pagination

* feat: use icon in component Popconfirm

* feat: use icon in component Progress

* feat: use icon in component Rate

* feat: use icon in component Result

* feat: use icon in component Select

* feat: use icon in component Step

* feat: use icon in component Switch

* feat: use icon in component Table

* feat: use icon in component Tab

* feat: use icon in component Tag

* feat: handle rest component which using Icon

* fix: remove unused vars

* feat: use latest alpha ant design icons

* fix: failed test in uploadlist.test.js

* test: update snapshot for icons

* doc: add Icon for site

* doc: use @ant-design/icons in site

* chore: use latest icons

* fix: tslint issue

* fix: test cases

* fix: types for react

* fix: lint rules for import orders

* fix: use @ant-design/icons@4.0.0-alpha.5 to avoid insert css in server render

* fix: eslint error in demo/**.md

* inject antd icons

* update snapshot

* fix site

* doc: update docs

* fix: code snippets icon in site

* feat: use latest @ant-design/icons

* fix: icon props in message
2019-08-13 14:07:17 +08:00

2.2 KiB
Raw Blame History

category type title subtitle
Components 通用 Button 按钮

按钮用于开始一个即时操作。

何时使用

标记了一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。

API

通过设置 Button 的属性来产生不同的按钮样式,推荐顺序为:type -> shape -> size -> loading -> disabled

按钮的属性说明如下:

属性 说明 类型 默认值 版本
disabled 按钮失效状态 boolean false 3.5.1
ghost 幽灵属性,使按钮背景透明,版本 2.7 中增加 boolean false
href 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 string -
htmlType 设置 button 原生的 type 值,可选值请参考 HTML 标准 string button
icon 设置按钮的图标组件 ReactNode -
loading 设置按钮载入状态 boolean | { delay: number } false
shape 设置按钮形状,可选值为 circleround 或者不设 string -
size 设置按钮大小,可选值为 small large 或者不设 string default
target 相当于 a 链接的 target 属性href 存在时生效 string -
type 设置按钮类型,可选值为 primary dashed danger link(3.17 中增加) 或者不设 string -
onClick 点击按钮时的回调 (event) => void -
block 将按钮宽度调整为其父宽度的选项 boolean false 3.8.0

支持原生 button 的其他所有属性。

FAQ

如何移除两个汉字之间的空格?

根据 Ant Design 设计规范要求,我们会在按钮内只有两个汉字时自动添加空格,如果你不需要这个特性,可以设置 ConfigProviderautoInsertSpaceInButtonfalse