Skip to main content

FieldProps <T, CustomProps, M>

When building a custom field you need to create a React component that takes this interface as props.

Index

Properties

optionalautoFocus

autoFocus?: boolean

Should this field autofocus on mount

context

context: FormContext<M>

Additional values related to the state of the form or the entity

optionalcustomProps

customProps?: CustomProps

Additional properties set by the developer

optionaldisabled

disabled?: boolean

Flag to indicate if this field should be disabled

optionalerror

error?: any

Is there an error in this field. The error field has the same shape as the field, replacing values with a string containing the error. It takes the value null if there is no error

optionalincludeDescription

includeDescription?: boolean

Should this field include a description

optionalisSubmitting

isSubmitting?: boolean

Is the form currently submitting

optionalpartOfArray

partOfArray?: boolean

Is this field part of an array

optionalpartOfBlock

partOfBlock?: boolean

Is this field part of a block (oneOf array)

property

property: ResolvedProperty<T>

Property related to this field

propertyKey

propertyKey: string

Key of the property E.g. "user.name" for a property with path "user.name"

setFieldValue

setFieldValue: (propertyKey: string, value: null | CMSType, shouldValidate?: boolean) => void

Set value of a different field directly


Type declaration

    • (propertyKey: string, value: null | CMSType, shouldValidate?: boolean): void
    • Parameters

      • propertyKey: string
      • value: null | CMSType
      • optionalshouldValidate: boolean

      Returns void

setValue

setValue: (value: null | T, shouldValidate?: boolean) => void

Set value of field directly


Type declaration

    • (value: null | T, shouldValidate?: boolean): void
    • Parameters

      • value: null | T
      • optionalshouldValidate: boolean

      Returns void

optionalshowError

showError?: boolean

Should this field show the error indicator. Note that there might be an error (like an empty field that should be filled) but we don't want to show the error until the user has tried saving.

optionaltableMode

tableMode?: boolean

Is this field being rendered in the entity table popup

optionaltouched

touched?: boolean

Has this field been touched

optionalunderlyingValueHasChanged

underlyingValueHasChanged?: boolean

Flag to indicate that the underlying value has been updated in the datasource

value

value: T

Current value of this field

Sign up to our newsletter to get the latest news and updates. No spam!