@synapsestudios/form-schema
v1.6.0
Published
A package to help create and export form schema for building dynamic forms
Downloads
217
Maintainers
Keywords
Readme
form-schema
A library for building and exporting a form schema that can be used to generate dynamic forms
Usage
const FormSchema = require('@synapsestudios/form-schema');
const formSchema = new FormSchema();
// addField with string args. Requires a name and a type
formSchema.addField('name', 'hidden');
// addField with object arg. Requires a name and a type
formSchema.addField({
name: 'some-great-field',
type: 'text',
label: 'Some Greate Field',
value: 'This is a cool field!',
});
// get the form schema as a plain old javascript object
const schema = formSchema.getFormSchema();
// remove a field by name
formSchema.removeField('some-great-field');
Development
git clone [email protected]:synapsestudios/form-schema.git
cd form-schema
yarn install