1.4.0 • Published 4 years ago

xy-checkbox v1.4.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago
IEChromeFirefoxOperaSafari
IE 10+ ✔Chrome 31.0+ ✔Firefox 31.0+ ✔Opera 30.0+ ✔Safari 7.0+ ✔

NPM version node version npm download

xy-checkbox

xy-checkbox

复选框, 复选框组 单选框, 单选框组

安装

# yarn
yarn add xy-checkbox utils-hooks classNames

使用例子

import React from "react";
import ReactDOM from "react-dom";
import { Checkbox, Radio, CheckboxGroup, RadioGroup } from "xy-checkbox";
// 可选的引入样式
import "xy-checkbox/assets/index.css";
ReactDOM.render(<Checkbox>复选框</Checkbox>, container);

API

Checkbox/Radio

属性说明类型默认值
name同原生 input checkbox 一样的 namestring
checked复选框是否选中booleanfalse
defaultChecked默认是否选中booleanfalse
indeterminate不确定状态booleanfalse
disabled是否禁用booleanfalse
children内容React.ReactNode
autoFocus是否自动聚集焦点booleanfalse
value同原生 input checkbox 一样的 value, 作为复选框组内使用时必须string
onChangeCheckbox 值更改事件(chcked: boolean, value: any) => void
onFocusCheckbox 聚集焦点事件(e: React.FocusEvent) => void
onBlurCheckbox 失去焦点事件(e: React.FocusEvent) => void
onClickCheckbox 点击事件(e: React.MouseEvent<HTMLInputElement, MouseEvent>) => void

CheckboxGroup

属性说明类型默认值
value选中复选框值集合any[]
defaultValue默认选中复选框值集合any[]
onChangechange 事件(val: any[], checkedAll: boolean) => void
onBlur复选框组失去焦点事件(e: React.FocusEvent) => void
disabled是否禁用整个组booleanfalse

RadioGroup

属性说明类型默认值
value选中复选框值集合any
defaultValue默认选中复选框值集合any
disabled是否禁用整个组booleanfalse
onChangechange 事件(val: any) => void
onBlur复选框组失去焦点事件(e: React.FocusEvent) => void

开发

yarn run start

例子

http://localhost:6006

测试

yarn run test

开源许可

xy-checkbox is released under the MIT license.

1.4.0

4 years ago

1.3.0

5 years ago

1.2.32

5 years ago

1.2.31

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.6

5 years ago

1.1.51

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago