/ Form

Easy to use form components for react

Easy to use form components for react

super-easy-react-forms

Easy to use form components for react.

legend="Legend"
label="Test Check Box"
value="test"
missingMessage="you must select this"
checked
isRequired
onBlur={() => {
//do something
}}
onChange={() => {
//do something
}}
/>


## Validation

I tried to make the validation as flexibile as possible. To add validation to an input just pass a function to the
validation prop. It will be called any time validation is run and passed the value of the input. The function should
return true if the value is valid.

```jsx
<Input
  name="five-example"
  validation={value => {
    return value === 5;
  }}
/>

Validation Types

To makevalidation eveneasier I have included a ValidationTypes object that has some prebuilt validation methods.
Just pick the one you need and pass it in.

so far I have these options:

  • ValidationTypes.NUMBER
  • ValidationTypes.TEXT
<Input name="five-example" validation={ValidationTypes.NUMBER} />

Required Fields

I wanted to be able to show different messaging for missing values than other types of validation so I setup a prop
specifically for required fields. Just add isRequired.

<Input name="required-example" isRequired />

GitHub