formcio
v8.1.0
Published
A library created with create-react-library
Downloads
493
Readme
Formcio
Made with create-react-library
Install
npm install --save formcio
Usage
import React from 'react';
import { FormBuilderComponent, FormGenerator } from "formcio";
const Form = () => {
const formData = [{
id: 432,
type: 'header h4',
label: 'Registration Form',
className: 'form-control',
style: { backgroundColor: '', width: '100%' },
tooltip: '',
alignment: 'text-center',
}];
const onSave = (data) => {
// Handle save data here
}
const onSubmit = (data) => {
// Handle submit data here
}
return (
<>
<FormBuilderComponent onSave={onSave} />
<FormGenerator array={formData} onSubmit={onSubmit} />
</>
);
}
export default Form;
FormbuilderComponent
-Used for generating form
Required props
-It require on save function.In onSave you receive array of fields. -To display form pass the received array of fields to FormGenerator component
FormGenerator
-Used to display form
Required props
-It requires array of fields to display forms -onSubmit funtion to perform action .In onSubmit you will receive json of form fields -filleData props is json of form fields to display default values