A form input builder and validator for React JS
A form input builder and validator for React.
| Quick Start | API | 1.x API |
|---|
christianalfoni wrote an article on forms and validation with React, Nailing that validation with React JS, the result of that was this library.
The main concept is that forms, inputs, and validation are done very differently across developers and projects. This React component aims to be that “sweet spot” between flexibility and reusability.
This project was originally located at christianalfoni/formsy-react if you're looking for old issues.
onSubmit, onValid, etc.)yarn add formsy-react react react-dom and use with webpack, browserify, etc.
The 2.0 release fixed a number of legacy decisions in the Formsy API, mostly a reliance on function props over value props passed down to wrapped components. However, the API changes are minor and listed below.
getErrorMessage() => errorMessagegetErrorMessages() => errorMessagesgetValue() => valuehasValue() => hasValueisFormDisabled(): => isFormDisabledisFormSubmitted() => isFormSubmittedisPristine() => isPristineisRequired() => isRequiredisValid(): => isValidshowError() => showErrorshowRequired() => showRequired…
withFormsy is a Higher-Order Component that
exposes additional props to MyInput. See the API documentation to view a complete list of the
props.
…
This code results in a form with a submit button that will run the submit method when the form is submitted with a
valid email. The submit button is disabled as long as the input is empty (required) and the value is
not an email (isEmail). On validation error it will show the message: "This is not a valid email".
See the API for more information.
yarnyarn lint runs lint checksyarn test runs the testsnpm run deploy build and release formsyCheck out our Changelog and releases
No open issues yet, or sync has not completed.