GithubHelp home page GithubHelp logo

wroud / react-painlessform Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 1.0 869 KB

React Forms without pain

License: MIT License

TypeScript 90.77% JavaScript 9.23%
yup typescript reusable-parts react reactjs form form-validation form-validation-react

react-painlessform's Introduction

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={f=>f.field}>
                    {({ inputHook, rest }) => <input {...inputHook, ...rest} />}
                </Field>
                <Field name={f=>f.field2}>
                    {({ inputHook, rest }) => <input {...inputHook, ...rest} />}
                </field>
                <button type="submit">Submit</button>
            </div>
        </Form>
    );
}

react-painlessform's People

Contributors

mindhalt avatar wroud avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mindhalt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.