Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyounghive committed Feb 1, 2018
1 parent 87479eb commit ab2c750
Showing 1 changed file with 25 additions and 29 deletions.
54 changes: 25 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,27 +163,25 @@ The `Form` component will accept the following props:
* name (string, required) - The name of the form.
* render (component/function, required) - Function/functional component that will render the form - passed InjectedFormProps as below
* renderProps (object, optional) - Custom props to pass to the render component
* validators?: (object, optional) - Form validation object - see validation
* initialValues?: (object, optional) - Initial form values in the form `{ [fieldName]: value }`
* onSubmit?: (function, optional) - Called on form submission with form values
* onSubmitFailed?: (function, optional) - Called when submission fails due to validation errors, with form values
* validators (object, optional) - Form validation object - see validation
* initialValues (object, optional) - Initial form values in the form `{ [fieldName]: value }`
* onSubmit (function, optional) - Called on form submission with form values
* onSubmitFailed (function, optional) - Called when submission fails due to validation errors, with form values
* onChange (function, optional) - Called when any form value changes, with all form values

The render component you provide will receive the following props:

* Field (Component) - A component to create fields
* form (object) - Props that must be passed to a <form> element
* values (object) - Current form values
* meta: {
valid (boolean) - Is validation currently passing
submitted (boolean) - Has the form been submitted at any time
errors: (object) - Current errors for the form, { [fieldName]: { error: string }}
isValidating (boolean) - Is validation currently ongoing
};
* actions: {
reset (function) - Call to reset the form to initial values and clear validation errors
submit: (function) - Call to submit the form
};
* meta (object)
* valid (boolean) - Is validation currently passing
* submitted (boolean) - Has the form been submitted at any time
* errors: (object) - Current errors for the form, { [fieldName]: { error: string }}
isValidating (boolean) - Is validation currently ongoing
* actions (object)
* reset (function) - Call to reset the form to initial values and clear validation errors
* submit: (function) - Call to submit the form
* ownProps (object) - Any additional props passed via `renderProps` above

### Field
Expand All @@ -199,21 +197,19 @@ The `Field` component (as provided to the `Form` renderer), can be passed the fo

The render component passed to `Field` is provided with the following props. The input prop should generally be passed directly to the underlying <input> element, i.e. <input {...input} />

* meta: {
valid (boolean) - Does the field pass validation
error (string | undefined) - Current validation error
pristine (boolean) - True if the field has the same value as its initial value
touched (boolean) - Has the field has ever been focused
active (boolean) - Is the field currently focused
isValidating (boolean) - Is the field currently being validated
};
* input: {
onChange (function) - Called with (event, value) when the field value changes
onFocus (function) - Called with (event, value) when the field is focused
onBlur (function) - Called with (event, value) when the field is blurred
value (string | number | undefined) - Current field value
name (string) - Name of the field
};
* meta (object)
* valid (boolean) - Does the field pass validation
* error (string | undefined) - Current validation error
* pristine (boolean) - True if the field has the same value as its initial value
* touched (boolean) - Has the field has ever been focused
* active (boolean) - Is the field currently focused
* isValidating (boolean) - Is the field currently being validated
* input (object)
* onChange (function) - Called with (event, value) when the field value changes
* onFocus (function) - Called with (event, value) when the field is focused
* onBlur (function) - Called with (event, value) when the field is blurred
* value (string | number | undefined) - Current field value
* name (string) - Name of the field
* ownProps - Any custom props passed to `Field`s `renderProps`

### Validation
Expand Down

0 comments on commit ab2c750

Please sign in to comment.