1.0.0 • Published 6 years ago

react-stateful-forms v1.0.0

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

react-stateful-forms

npm version npm downloads

React Stateful Forms Library.

Install

$ npm install react-stateful-forms --save

Features

  • React Form component infrastructure.
  • No redux/flux required.
  • Built-in custom validation error.

Usage

import { Form, Field } from "react-stateful-forms";

  render() {
      ...

        <Form onSubmit={ this.submitMyForm } name="test_form" header="My Test Form">

          <Field title="Name"
            value="John Doe"
            name="name"
            disabled={ false }
            validator={ (value) => { if (value === "John Doe") return "Please change default value"; return undefined; } }
            required inputType="text" />

          <Field title="Male"
            value="male"
            name="gender"
            inputType="radio" />

          <Field title="Female"
            value="female"
            name="gender"
            inputType="radio" />

          <Field title="Subscribe"
            name="subscribe"
            value={ false }
            required
            inputType="checkbox" />

        </Form>
    ...
}