0.1.3 • Published 4 years ago

xy-input v0.1.3

Weekly downloads
2
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-input

xy-input

输入框, 文本域组件

安装

# yarn
yarn add xy-input

使用例子

import React from "react";
import ReactDOM from "react-dom";
import { Input, InputGroup, TextArea } from "xy-input";
ReactDOM.render(<Input />, container);

API

通用属性

属性说明类型默认值
disabled是否禁用booleanfalse
value输入框值string
defaultValue输入框默认值string
placeholder占位符文本string
autoFocus自动焦点boolean
onFocus输入框焦点事件(e: React.FocusEvent) => void
onBlur输入框失去焦点事件(e: React.FocusEvent) => void
onKeyDown键盘事件(e: React.KeyboardEvent) => void
onChange输入框 change 事件(value: string, event?: React.ChangeEvent) => void
onCompositionStart开始输入中文(e: React.CompositionEvent) => void
onCompositionEnd输入中文完毕(e: React.CompositionEvent) => void

Input

属性说明类型默认值
type输入框类型"text"/"password"
clearable是否显示清除"text"/"password"
onClean清除按钮点击事件Function
addonBefore前置标签React.ReactNode
addonAfter后置标签React.ReactNode
prefix前置图标React.ReactNode
suffix后置图标React.ReactNode

InputGroup

属性说明类型默认值
compact是否紧凑模式boolean

TextArea

属性说明类型默认值
autosize是否自动调整尺寸boolean/TextAreaSize

开发

yarn run start

例子

http://localhost:6006

测试

yarn run test

开源许可

xy-input is released under the MIT license.