JSPM

react-form-validation

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 11
    • Score
      100M100P100Q48891F
    • License MIT

    Form validation for React

    Package Exports

    • react-form-validation

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-form-validation) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    react-form-validation

    Simple and powerful form validation library for React.

    Getting Started

    Install with NPM

    npm install react-form-validation

    Install with Bower

    bower install react-form-validation

    Install in web page

    The project includes a browserified and minified version of the library that can be easily be included into any web page. You may include the file /dist/react-form-validation.js on your website.

    <script src="/path/to/react-form-validation.js"></script>

    Basic usage

    Create a form instance. This is the configuration for your form. You will have to pass this form as props to other components. You can save that object in the state of your component.

    getInitialState: function() {
        return {
            form: new Instance({
                fields: {
                    name: Rules.required()
                }
            })
        };
    }

    Use the Form, Input and Error Components inside your project.

    <Form form={this.props.form} onSubmit={this.onSubmit}>
        <Input name="name" type="text" form={this.props.form} />
        <Error forName="name" form={this.props.form} />
    </Form>