Schema

A FormForge schema is a plain JavaScript object where each key is a field name and each value describes that field.

Field types

TypeDescription
textSingle-line text input
emailEmail input with format validation
passwordPassword input (masked)
numberNumeric input with min/max
textareaMulti-line text input (full width)
dateDate picker
checkboxBoolean toggle (full width)
radioOption group (full width)
selectDropdown selection
arrayRepeatable list of fields
objectNested group of fields

Common field options

{
  type: 'text',          // field type (required)
  label: 'Full Name',   // displayed label
  placeholder: 'John',  // input placeholder
  required: true,        // marks field required
  disabled: false,       // disables the field
  defaultValue: '',      // initial value
  group: 'personal',    // manual group hint for layout
  showIf: (values) =>   // conditional visibility
    values.role === 'admin',
  validate: rules.minLength(3),  // custom validation
}

Text fields

email:    { type: 'email',    label: 'Email' },
password: { type: 'password', label: 'Password', minLength: 8 },
bio:      { type: 'textarea', label: 'Bio' },

Number

age: {
  type: 'number',
  label: 'Age',
  min: 18,
  max: 99,
  step: 1,
}

Select & Radio

country: {
  type: 'select',
  label: 'Country',
  options: [
    { value: 'us', label: 'United States' },
    { value: 'in', label: 'India' },
    { value: 'gb', label: 'United Kingdom' },
  ],
},

role: {
  type: 'radio',
  label: 'Role',
  options: [
    { value: 'admin', label: 'Admin' },
    { value: 'user',  label: 'User' },
  ],
},

Conditional fields

state: {
  type: 'text',
  label: 'State',
  showIf: (values) => values.country === 'us',
},

Array (repeater)

links: {
  type: 'array',
  label: 'Social Links',
  minItems: 1,
  maxItems: 5,
  items: {
    platform: {
      type: 'select',
      label: 'Platform',
      options: [
        { value: 'twitter', label: 'Twitter' },
        { value: 'linkedin', label: 'LinkedIn' },
      ],
    },
    url: { type: 'text', label: 'URL' },
  },
},

Nested object

address: {
  type: 'object',
  label: 'Address',
  fields: {
    street:  { type: 'text', label: 'Street' },
    city:    { type: 'text', label: 'City' },
    country: { type: 'text', label: 'Country' },
  },
},