1.1.5 • Published 5 years ago

form2 v1.1.5

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

form2

React component to let you use form without use component state

NPM JavaScript Style Guide

Install

npm install --save form2

Usage

import React, { Component } from 'react'

import Form from 'form2'
import './App.css'

export default class App extends Component {
  render () {
    return (
      <div>
        <Form fields={
          [
            {
              type: 'text',
              name: 'username',
              placeholder: 'Type Username..',
              id: 'username',
              className: 'textField',
              onChange: (event) => { console.log(`VALUE IS: ${event.target.value}`) }
            },
            {
              type: 'text',
              name: 'password',
              placeholder: 'Type Password..',
              id: 'password',
              className: 'textField'
            }]
        } />
      </div>
    )
  }
}

Field Types Supported

  • Text field

    Options

    Options can be added on the fields options:

    const myFields = [{ OPTIONS_HERE_AS_OBJECT_PROPERTIES }];
and you should send the `myFields` array as a `fields` props on the form2 component
```jsx
<Form2 fields={myField} />

The fields options by type:

  • Text:

    • type: required, should be => 'text'
    • name: required, string
    • Any input props (e.g: className, id, key, disabled ...)

License

MIT © mhmdtshref

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago