# xy-input

> 基于React的输入框组件

Latest version **0.1.3** (published 2019-12-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install xy-input
pnpm add xy-input
yarn add xy-input
bun add xy-input
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2019-12-23 |
| First published | 2019-04-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 36.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | XueYou |
| Maintainers | xueyou2000 |
| Keywords | react, react-component, xy-input |

## Links

- npm: https://www.npmjs.com/package/xy-input
- Repository: https://github.com/xueyou2000/xy-input
- Homepage: https://github.com/xueyou2000/xy-input#readme
- Issues: https://github.com/xueyou2000/xy-input/issues
- npm.io page: https://npm.io/package/xy-input

## Dependencies (7)

- [react](https://npm.io/package/react.md) ^16.12.0
- [react-dom](https://npm.io/package/react-dom.md) ^16.12.0
- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [utils-hooks](https://npm.io/package/utils-hooks.md) ^0.0.71
- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) ^0.1.4
- [@fortawesome/fontawesome-svg-core](https://npm.io/package/@fortawesome/fontawesome-svg-core.md) ^1.2.22
- [@fortawesome/free-solid-svg-icons](https://npm.io/package/@fortawesome/free-solid-svg-icons.md) ^5.10.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.3 (latest) — 2019-12-23
- 0.1.2 — 2019-12-23
- 0.1.1 — 2019-12-23
- 0.1.0 — 2019-11-19
- 0.0.92 — 2019-09-04
- 0.0.91 — 2019-05-12
- 0.0.9 — 2019-05-05
- 0.0.8 — 2019-04-30
- 0.0.7 — 2019-04-26
- 0.0.61 — 2019-04-24
- 0.0.6 — 2019-04-24
- 0.0.5 — 2019-04-24
- 0.0.4 — 2019-04-19
- 0.0.3 — 2019-04-18
- 0.0.2 — 2019-04-18

## README

| ![IE](https://github.com/alrra/browser-logos/blob/master/src/edge/edge_48x48.png?raw=true) | ![Chrome](https://github.com/alrra/browser-logos/blob/master/src/chrome/chrome_48x48.png?raw=true) | ![Firefox](https://github.com/alrra/browser-logos/blob/master/src/firefox/firefox_48x48.png?raw=true) | ![Opera](https://github.com/alrra/browser-logos/blob/master/src/opera/opera_48x48.png?raw=true) | ![Safari](https://github.com/alrra/browser-logos/blob/master/src/safari/safari_48x48.png?raw=true) |
| ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| IE 10+ ✔                                                                                   | Chrome 31.0+ ✔                                                                                     | Firefox 31.0+ ✔                                                                                       | Opera 30.0+ ✔                                                                                   | Safari 7.0+ ✔                                                                                      |

![NPM version](http://img.shields.io/npm/v/xy-input.svg?style=flat-square)
![node version](https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square)
![npm download](https://img.shields.io/npm/dm/xy-input.svg?style=flat-square)

[![xy-input](https://nodei.co/npm/xy-input.png)](https://npmjs.org/package/xy-input)

# xy-input

输入框, 文本域组件

## 安装

```bash
# yarn
yarn add xy-input
```

## 使用例子

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

## API

### 通用属性

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

## 开发

```sh
yarn run start
```

## 例子

http://localhost:6006

## 测试

```
yarn run test
```

## 开源许可

xy-input is released under the MIT license.

---
_Source: https://npm.io/package/xy-input · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
