Form
Extends:
Component → Form
Basic form element
PropTypes
property | type | type signature | description |
---|---|---|---|
className |
string |
form class name | |
values |
object |
values to fill the form | |
onChange |
function |
(inputName, input) => {} ) |
form change handler |
onSubmit |
function |
(values) => {} |
fired after form submit |
Example:
import { Form, Input } from 'prg-form';
function MyForm ({ values }) {
return (
<Form
className="special-class"
onSubmit={(values, form) => console.log(values)}
onChange={(input) => console.log(input.name, input.getValue())}
values={values}
>
<Input type="email" name="inputName" label="Input Label" />
</Form>
);
}
Method Summary
Public Methods | ||
public |
Returns current form data |
|
public |
Resets form without trigging the onChange method |
|
public |
Sets errors to form. |