Fields


Fields are added to forms via the fields array and create the editing interface of a form.

Field Config

All field plugins share a common config:

interface FieldConfig {
  name: string
  component: string | ReactComponent
  parse?(value: any, name: string, field: Field): any
  format?(value: any, name: string, field: Field): any
  validate?(
    value: any,
    allValues: any,
    meta: any,
    field: Field
  ): string | object | undefined
}
keydescription
nameEquivalent of an input's name attribute.
componentEither a string denoting a field already registered with the CMS, or a custom field component.
parseOptional: Prepare the data for usage in the field component.
formatOptional: Prepare the data for saving.
validateOptional: Return undefined when valid. Return a string or an object when there are errors.