# form-lib

> Form component for React

Latest version **0.2.1** (published 2018-08-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install form-lib
pnpm add form-lib
yarn add form-lib
bun add form-lib
```

## 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.2.1 |
| Published | 2018-08-03 |
| First published | 2017-05-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 34.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Simon Guo |
| Maintainers | simonguo |
| Keywords | react, form, component |

## Links

- npm: https://www.npmjs.com/package/form-lib
- Repository: https://github.com/rsuite/form-lib
- Homepage: https://github.com/rsuite/form-lib#readme
- Issues: https://github.com/rsuite/form-lib/issues
- npm.io page: https://npm.io/package/form-lib

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) ^4.17.3
- [classnames](https://npm.io/package/classnames.md) >=2.0.0
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.10
- [rsuite-utils](https://npm.io/package/rsuite-utils.md) ^0.1.0

## 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.2.1 (latest) — 2018-08-03
- 3.0.0-next (next) — 2018-02-26
- 2.0.0 (version2.x) — 2017-12-05
- 0.2.0 — 2018-08-02
- 0.1.8 — 2018-04-09
- 0.1.7 — 2018-03-22
- 0.1.6 — 2018-03-22
- 0.1.5 — 2018-03-22
- 0.1.4 — 2017-11-07
- 0.1.3 — 2017-09-25
- 0.1.2 — 2017-09-20
- 0.1.1 — 2017-09-07
- 0.1.0 — 2017-08-04
- 0.0.9 — 2017-08-04
- 0.0.8 — 2017-08-03
- … 7 more at https://npm.io/package/form-lib/versions

## README

# form-lib

`React` 实现的 `Form` 组件， 和 `rsuite-schema` 结合使用可以很好的对表单数据进行校验。

[rsuite-schema API 文档](https://rsuitejs.com/components/schema)

`form-lib` 中主要提供了两个组件: `<Form>` 和 `<Field>`,  `<Field>` 必须包含在 `<Form>` 内，例如:

```html
<Form>
  <Field />
  <Field />
</Form>
```

`<Form>` 提供了 `values` 和 `defaultValues` 为整个表单设置值，对应的分别是受控和非受控表单。
同时提供了 `onChange` (数据发生改变时候触发) 和 `onCheck` (数据校验时候触发) 事件。

`<Field>` 必须拥有 `name` 属性， 并且属性值必须和 `SchemaModel` 声明的校验对象字段名一致，
`<Field>` 默认是一个 `input[type='text']` 组件， 如果需要自定义，设置一个 `accepter` 属性，
该属性是设置需要受理的表单组件。受理的组件必须实现 `value`, `defalutValue`,`onChange` 和 `onBlur` 等 API

------
## 快速开始

### 安装

```
npm i form-lib --save
```

安装 `rsuite-schema`

```
npm i rsuite-schema --save
```

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