Skip to content

Overview

PropTypeDescription
schemaObjectForm schema, filled with field groups and/or fields
modelObjectModel object, contains all form data
idPrefixstringPrefix for all the generated ids in the form

model

Type: Object

A model consists of keys that each have their own value and type of value. The value initially set in the model will determine the type of the value, and the initial model value.

javascript
{
  firstName: '', 
  lastName: '', 
  iAmLukeSkywalker: false
}

schema

Type: Object

Properties

PropertyTypeDescription
fieldsArray<Object>Array of field objects
groupsArray<Group>Array of field objects

Group

PropertyTypeDescription
legendstringForm group header, legend HTML element
fieldsArray<Object>Array of field objects
javascript
{
  fields: [
    {
      name: 'first_name',
      label: 'First name',
      model: 'firstName', // corresponds to `firstName` key in model object.
      type: 'input',
      inputType: 'text'
    },
    {
      name: 'last_name',
      label: 'Last name',
      model: 'lastName' // corresponds to `lastName` key in model object.
      type: 'input',
      inputType: 'text'
    }
  ],
    groups: [
    {
      legend: 'More information',
      fields: [
        {
          name: 'luke_skywalker',
          label: 'I am Luke Skywalker',
          model: 'iAmLukeSkywalker',
          type: 'input',
          inputType: 'checkbox'
        },
        {
          buttonText: 'This is me',
          type: 'submit'
        }
      ]
    }
  ]
}

Result

{
  "firstName": "",
  "lastName": "",
  "iAmLukeSkywalker": false
}
More information