fv-react-form
Version:
Flexible React form with validation.
67 lines (49 loc) • 1.56 kB
Markdown
with validation.
To install into your project, run this command.
```bash
npm install --save fv-react-form
```
```js
import Form from "fv-react-form";
class Example extends Component {
render() {
return (
<Form
// Called if validation passes
action={form => console.log(form)}
method="POST"
name="login"
rules={{
name: 'required'
}}
// Called every time form is submitted
onSubmit={form => console.log(form)}
>
{/* Show all errors */}
<Form.Errors/>
<Form.Group>
<Form.Input type="name" name="name" placeholder="Name"/>
{/* Show field error */}
<Form.Error field="name"/>
</Form.Group>
<Form.Button type="submit">Submit</Form.Button>
</Form>
);
}
}
```
To build examples, run this command.
```bash
npm run build-examples
```
All contributions are welcome. Before starting work on your contribution, please contact the maintainer to make sure
no one else is working on the same contribution as you. To develop examples, run this command.
```bash
npm run dev-examples
```
If you add a new example, make sure to update the compiler file webpack.mix.js with your new example file.
Flexible React form