0.0.2 • Published 6 years ago
ello-form-react v0.0.2
ello-form-react
react form
Install
npm install --save ello-form-reactUsage
import React, { Component } from "react";
import EllocentForm from "ello-form-react";
class Example extends Component {
render() {
return <EllocentForm
fields = {[{
label : "",
name : "",
component: "",
value : "",
size : ""
}
...]}
/>;
}
}##Props
| Props | Description |
|---|---|
| fields | Array of field Object |
| submitText | Submit button text |
| onChange | Callback for on value change |
| onSubmit | Callback for form submit. This will returns form data as json object |
| formCss | css class name for form conatiner |
| buttonContainerCss | css class name for submit button container |
| buttonCss | css class name for submit button |
| labelCss | css class name for all field labels |
| extraAction | Array of button object |
Fields
| Props | Description |
|---|---|
| name | Name of field |
| label | Lable text |
| placeholder | placeholder |
| component | one of "input", "select", "select-async", "check", "tag-input", "file",smart-textarea" |
| regularExp | Validation reg exp |
| errorText | Validation error message |
| type | Type of input filed. Required if component is "input" |
| checked | Required if component is "check" |
| api/optionLoader | Required if component is "select-async" |
| multiSelect | Optional For "select" or "select-async" component |
| disabled | Disable the field |
| stayOpenOnSelect | Optional For "select" or "select-async" component |
| label | Lable text |
| value | default value |
| options | Array of '{label : "", value : "" }'. Required if component is "select" or "select-async". |
License
MIT © CodeLover12