react-material-final-form
Easy & Simple form with Material UI and Final Form.
GetStarted
npm i --save react-material-final-form
;; const title = 'My form';const metadata = fields: key: 'text' type: 'String' label: 'Text' key: 'defaultValue' type: 'String' label: 'Default Value' key: 'number' type: 'Number' label: 'Number' key: 'disabledField' type: 'String' label: 'Disabled Field' isDisabled: true ; const data = defaultValue: 'Value'; { return <Fragment> <h1>React Material Final Form</h1> <DetailForm title=title metadata=metadata data=data debug=true onSubmit=consolelog /> </Fragment> } ;
Dependencies
"dependencies":
Fields
Text
key: 'text' type: 'string' label: 'Text'
Textarea
key: 'textarea' type: 'string' label: 'Text Area' formType: 'textarea'
Text (US Phone)
key: 'phone' type: 'string' label: 'Phone' formType: 'phone'
Number
key: 'number' type: 'number' label: 'Number'
Date
key: 'date' type: 'string' label: 'Date' formType: 'date'
Date Time
key: 'dateWithParseFunction' type: 'string' label: 'Date with parse function' formType: 'date' { return ; } { return ; }
Radio
key: 'radio' type: 'number' label: 'Radio' formType: 'Radio' formOptions: label: '1' value: 1 label: '2' value: 2 label: '3' value: 3
Checkbox
key: 'checkbox' type: 'Array' label: 'Checkbox' formType: 'Checkbox' formOptions: label: 'English' value: 'English' label: 'Mandarin' value: 'Mandarin' label: 'Spanish' value: 'Spanish' label: 'Cantonese' value: 'Cantonese' label: 'Vietnamese' value: 'Vietnamese' label: 'Tagalog' value: 'Tagalog' label: 'Malay' value: 'Malay' label: 'Korean' value: 'Korean' label: 'Japanese' value: 'Japanese' label: 'French' value: 'French' label: 'German' value: 'German'
Array Items
key: 'profile.address' type: 'Array' label: 'Address' formType: 'InputArray' formInputArrayObject: key: 'street' label: 'Street' key: 'city' label: 'City' key: 'state' label: 'State' key: 'zipCode' label: 'Zip Code'
Object Item
key: 'selectObject' type: 'Object' label: 'Select Object' formType: 'Object' formObjects: key: 'prop1' type: 'Number' label: 'Prop 1' formType: 'Select' formOptions: label: '1' value: 1 label: '2' value: 2 label: '3' value: 3 key: 'prop2' type: 'Number' label: 'Prop 2' formType: 'Radio' formOptions: label: 'a' value: 'a' label: 'b' value: 'b' label: 'c' value: 'c'
Disabled
key: 'disabledField' type: 'string' label: 'Disabled Field' isDisabled: true
Not Required
key: 'notRequired' type: 'string' label: 'Not Required field' isRequired: false