This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

react-painlessform
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

react-painlessform

Uses React 16.3 Context

Painless Form is a bunch of React Components that helps you:

  • Validate form via custom validator or Yup.Schema or combined validator!
  • Calculate fields
  • Use typescript for type checking in fields!
  • Create reusable form parts with own Validation & Transform

without any configs only declarative style.

Travis codecov GitHub issues GitHub license npm version npm downloads

Install

npm install --save react-painlessform

Documentation

Examples

import { createFormFactory } from "react-painlessform";

interface IModel {
    field: number;
    field2: string;
}

const { Form, Field } = createFormFactory<IModel>();

const MyForm = (props) => {
    return (
        <Form initValues={values} onModelChange={onModelChange}>
            <div>
                <Field name={"field"}>
                    {({ name, value, onClick, onChange, rest }) => (
                        <input name={name} value={value} onClick={onClick} onChange={onChange} {...rest} />
                    )}
                </Field>
                <Field name={"field2"}>
                    {({ name, value, onClick, onChange, rest }) => (
                        <input name={name} value={value} onClick={onClick} onChange={onChange} {...rest} />
                    )}
                </field>
                <button type={"submit"}>Submit</button>
            </div>
        </Form>
    );
}

Readme

Keywords

Package Sidebar

Install

npm i react-painlessform

Weekly Downloads

83

Version

2.0.1

License

MIT

Unpacked Size

144 kB

Total Files

66

Last publish

Collaborators

  • wroud