xy-button

基于 React Hooks 的按钮组件


Keywords
react, react-component, xy-button
License
MIT
Install
npm install xy-button@1.1.0

Documentation

IE Chrome Firefox Opera Safari
IE 10+ ✔ Chrome 31.0+ ✔ Firefox 31.0+ ✔ Opera 30.0+ ✔ Safari 7.0+ ✔

NPM version node version npm download

xy-button

Button

按钮用于开始一个即时操作。在线例子

安装

# yarn
yarn add xy-button classnames

使用例子

import React from "react";
import ReactDOM from "react-dom";
import { Button, ButtonGroup } from "xy-button";
ReactDOM.render(<Button>按钮</Button>, container);

何时使用

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

API

按钮

属性 说明 类型 默认值
ghost 幽灵属性,使按钮背景透明 boolean false
long 是否长按钮 boolean false
icon 设置按钮的图标类型 IconDefinition -
loading 设置按钮载入状态 boolean false
disabled 按钮失效状态 boolean false
shape 设置按钮形状,可选值为 circle 或者不设 string -
size 设置按钮大小,可选值为 small large 或者不设 string default
type 设置按钮类型,可选值为 primary dashed text danger 或者不设 string -
onClick click 事件的 handler function -

按钮组

属性 说明 类型 默认值
shape 设置按钮形状,可选值为 circle 或者不设 string -
size 设置按钮大小,可选值为 small large 或者不设 string default
vertical 是否垂直 boolean false

开发

yarn run start

例子

http://localhost:6006

测试

yarn run test

开源许可

xy-button is released under the MIT license.