# antd-input

> 对antd的Input/TextArea进行一层封装，限制用户输入长度，并实时显示用户输入的长度，可以单独使用，也可以结合表单一起使用，LimitInput属性与antd的Input完全保持一致，暂时没有自身独特的属性；LimitTextArea只有一个额外属性sep，表示分割符，可以是个字符串，如：','，也可以是个正则表达式，如：/\n\r/，默认为''

Latest version **0.0.4** (published 2020-01-22) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2020-01-22 |
| First published | 2019-12-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 13.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | tqcheng |
| Maintainers | tqcheng |
| Keywords | antd, ant-input, input, limitInput, limit-input, limitTextArea, limit-textarea |

## Links

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

## Dependencies (3)

- [antd](https://npm.io/package/antd.md) ^3.26.2
- [react](https://npm.io/package/react.md) ^16.12.0
- [react-dom](https://npm.io/package/react-dom.md) ^16.12.0

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2020-01-22
- 0.0.3 — 2019-12-19
- 0.0.2 — 2019-12-19
- 0.0.1 — 2019-12-19

## README

# antd-input

对antd的Input/TextArea进行一层封装，限制用户输入长度，并实时显示用户输入的长度，可以单独使用，也可以结合表单一起使用，LimitInput属性与antd的Input完全保持一致，暂时没有自身独特的属性；LimitTextArea只有一个额外属性sep，表示分割符，可以是个字符串，如：','，也可以是个正则表达式，如：/\n\r/，默认为''

## React antd-input
[![Build Status](https://travis-ci.org/ctq123/antd-input.svg?branch=master&foo=bar)](https://travis-ci.org/ctq123/antd-input)
[![NPM version](https://img.shields.io/badge/npm-v5.7.1-green.svg?style=flat)](https://www.npmjs.com/package/antd-input)

# install
npm i antd-input
# Usage

## 例子
![image](https://github.com/ctq123/antd-input/blob/master/example3.png)
```
import React, { PureComponent, Fragment } from 'react'
import { LimitInput } from 'antd-input'

class LimitInputExample extends PureComponent {
  state = {
    val: ''
  }

  onChange = (e) => {
    e.preventDefault()
    this.setState({ val: e.target.value })
  }
  
  render() {
    const style = {
      width: '100%',
      margin: '8px 0px',
      textAlign: 'left',
    }
    return (
      <Fragment>
        <div style={style}>单独使用：</div>
        <LimitInput
          value={this.state.val}
          onChange={ e => this.onChange(e) }
          />
        <div style={style}>
          输入内容：{this.state.val}
        </div>
      </Fragment>
    )
  }
}
```

```
import React, { PureComponent, Fragment } from 'react'
import { LimitTextArea } from 'antd-input'

class LimitTextAreaExample extends PureComponent {
  state = {
    val: ''
  }

  onChange = (e) => {
    e.preventDefault()
    this.setState({ val: e.target.value })
  }
  
  render() {
    const style = {
      width: '100%',
      margin: '8px 0px',
      textAlign: 'left',
    }
    return (
      <Fragment>
        <div style={style}>单独使用：</div>
        <div style={style}>
          <LimitTextArea
            value={this.state.val}
            sep={'\n'}
            onChange={ e => this.onChange(e) }
            placeholder={'一行一条数据'}
          />
        </div>
        <div style={style}>
          输入内容：{this.state.val}
        </div>
      </Fragment>
    )
  }
}
```

# Prop Types

## LimitInput
属性与antd的Input完全保持一致，暂时没有自身独特的属性

属性 | 描述 | 类型 | 默认值 | 是否必填
---|---|---|---|--
maxLength | 设置用户最大输入字符数，原antd的Input属性 | number | 50 | 否

## LimitTextArea
属性 | 描述 | 类型 | 默认值 | 是否必填
---|---|---|---|--
maxLength | 设置用户最大输入字符数，原antd的InputArea属性 | number | 200 | 否
sep | 分割符，可以是个字符串，如：','，也可以是个正则表达式，如：/\n\r/ | string | '' | 否

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