react-formui

1.4.0 • Public • Published

react-formui

Another approach for React Form.

NPM code style: prettier

Features

Install

yarn add react-formui

Usage

import React, { Fragment } from 'react'
 
import Form from 'react-formui'
 
const fields = {
  firstName: 'Khalil',
  lastName: {
    value: 'Zhang',
    parser: v => v,
    formatter: v => v,
    rules: 'required|min:2|max:10',
  },
}
 
export default () => (
  <Form fields={fields}>
    {({ Field, TextInput, changed }) => (
      <Fragment>
        <Field name="firstName" component={TextInput} />
        <Field name="lastName" component={TextInput} />
        <button disabled={!changed}>提交</button>
      </Fragment>
    )}
  </Form>
)

License

MIT © starandtina

Readme

Keywords

none

Package Sidebar

Install

npm i react-formui

Weekly Downloads

1

Version

1.4.0

License

MIT

Unpacked Size

1.46 MB

Total Files

6

Last publish

Collaborators

  • starandtina