easy-forms

0.2.4 • Public • Published

EasyForm

Forms and React made easy.

Benefits

  1. Ease of use.
  2. Best of both worlds (React and Javascript).
  3. Form object to popular the form, get the values afterwards
  4. React components to render the form.
  5. Extensible
  6. Easy to define new Input types.

Usage

npm install --save easy-forms
import {Form, Input} from 'easy-forms';
import React from 'react';
 
 
class MyForm extends React.Component {
  constructor(args) {
    super(args);
    this.form = new Form;
  }
  render() {
    let form = this.form;
    return <form.Container>
      <div className="form-group">
        <label>E-mail</label>
        <Input type="email" className="form-control" name="email" placeholder="E-mail address" />
      </div>
      <div className="form-group">
        <label>Password</label>
        <Input type="password"  className="form-control" name="password" placeholder="Password" />
      </div>
      <button onClick={e => {
        console.error('submit form with values', form.getValues()) 
      }} className="btn btn-default">Submit</button>
    </form.Container>
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i easy-forms

Weekly Downloads

1

Version

0.2.4

License

ISC

Last publish

Collaborators

  • crodas