1.3.91 • Published 3 years ago
react-form-designer v1.3.91
react-form-designer
UI for creating forms via dragging dropping required options
Install
npm install --save react-form-designer
Usage
import React, { Component } from 'react'
import FormDesigner from 'react-form-designer'
const App = () => {
const [fields, setFields] = useState([])
return (
<FormDesigner
fields={fields}
onChange={(newFields) => setFields(newFields)}
onFieldStartedEdit={(fieldStartedEdit) => console.log(fieldStartedEdit)}
onFieldEdit={(fieldOnEdit) => console.log({ fieldOnEdit })}
onFieldDelete={(deletedField) => console.log({ deletedField })}
containerHeight={900}
expectedOptions={[
'SINGLECHECKBOX',
'MULTIPLECHECKBOXES',
'DATEPICKER',
'DROPDOWNSELECT',
'SINGLELINETEXT',
'MULTIPLECHECKBOXES',
'MULTILINETEXT',
'FILE',
'RADIOSELECT',
'CONTACT',
'NUMBER'
]}
customOptions={[
{
type: 'SINGLECHECKBOX',
title: 'Single Check Box',
options: true,
renderIn: (field,fieldIndex) => {
return <div>this is custom JSX{fieldIndex}</div>
}
},
{
type: 'MULTIPLECHECKBOXES',
title: 'Multiple Checkboxes',
options: true,
renderIn: (field,fieldIndex) => {
return <div>this is custom JSX{fieldIndex}</div>
}
},
{
type: 'DATEPICKER',
title: 'Date Picker',
options: true,
renderIn: (field,fieldIndex) => {
return <div>this is custom JSX{fieldIndex}</div>
}
},
{
type: 'DROPDOWNSELECT',
title: 'Dropdown Select',
options: true,
renderIn: (field,fieldIndex) => {
return <div>this is custom JSX{fieldIndex}</div>
}
},
{
type: 'SINGLELINETEXT',
title: 'Single Line Text',
options: true,
renderIn: (field,fieldIndex) => {
return <div>this is custom JSX{fieldIndex}</div>
}
},
{
type: 'MULTIPLECHECKBOXES',
title: 'Multiple checkboxes',
options: true,
renderIn: (field,fieldIndex) => {
return <div>this is custom JSX{fieldIndex}</div>
}
},
{
type: 'MULTILINETEXT',
title: 'Multiline text',
options: true,
renderIn: (field,fieldIndex) => {
return <div>this is custom JSX{fieldIndex}</div>
}
},
{
type: 'FILE',
title: 'File',
options: true,
renderIn: (field,fieldIndex) => {
return <div>this is custom JSX{fieldIndex}</div>
}
},
{
type: 'RADIOSELECT',
title: 'Radio Select',
options: true,
renderIn: (field,fieldIndex) => {
return <div>this is custom JSX{fieldIndex}</div>
}
},
{
type: 'CONTACT',
title: 'Contact',
options: true,
renderIn: (field,fieldIndex) => {
return <div>this is custom JSX{fieldIndex}</div>
}
},
{
type: 'NUMBER',
title: 'Number',
options: true,
renderIn: (field,fieldIndex) => {
return <div>this is custom JSX{fieldIndex}</div>
}
}
]}
/>
)
}
Optional Parameters
- expectedOptions
- styles
- renderInToolBox
- onFieldEdit
- onFieldDelete
- onFieldStartedEdit
- customOptions
- containerHeight
License
MIT © AmirjanyanIT
1.3.91
3 years ago
1.3.9
3 years ago
1.3.8
3 years ago
1.3.7
3 years ago
1.3.6
4 years ago
1.3.5
4 years ago
1.3.42
4 years ago
1.3.4
4 years ago
1.3.41
4 years ago
1.3.3
4 years ago
1.3.2
4 years ago
1.3.1
4 years ago
1.3.0
4 years ago
1.2.5
4 years ago
1.2.0
4 years ago
1.1.11
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.37
4 years ago
1.0.36
4 years ago
1.0.35
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago