Skip to main content

Interface: FieldProps<T, CustomProps, M>

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

Type parameters#

NameType
TT: CMSType
CustomPropsCustomProps = any
MM: Object = any

Properties#

autoFocus#

autoFocus: boolean

Should this field autofocus on mount

Defined in#

models/fields.tsx:97


context#

context: FormContext<M>

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

Defined in#

models/fields.tsx:107


customProps#

customProps: CustomProps

Additional properties set by the developer

Defined in#

models/fields.tsx:102


dependsOnOtherProperties#

dependsOnOtherProperties: boolean

Flag to indicate if this field was built from a property that gets rendered conditionally

Defined in#

models/fields.tsx:118


disabled#

disabled: boolean

Flag to indicate if this field should be disabled

Defined in#

models/fields.tsx:112


error#

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

Defined in#

models/fields.tsx:61


includeDescription#

includeDescription: boolean

Should this field include a description

Defined in#

models/fields.tsx:76


initialValue#

initialValue: undefined | T

Initial value of this field

Defined in#

models/fields.tsx:36


isSubmitting#

isSubmitting: boolean

Is the form currently submitting

Defined in#

models/fields.tsx:46


name#

name: string

Name of the property

Defined in#

models/fields.tsx:26


partOfArray#

partOfArray: boolean

Is this field part of an array

Defined in#

models/fields.tsx:87


property#

property: Property<T>

Property related to this field

Defined in#

models/fields.tsx:71


setValue#

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

Set value of field directly

Type declaration#

▸ (value, shouldValidate?): void

Parameters#
NameType
valuenull | T
shouldValidate?boolean
Returns#

void

Defined in#

models/fields.tsx:41


showError#

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.

Defined in#

models/fields.tsx:54


tableMode#

tableMode: boolean

Is this field being rendered in the table

Defined in#

models/fields.tsx:92


touched#

touched: boolean

Has this field been touched

Defined in#

models/fields.tsx:66


underlyingValueHasChanged#

underlyingValueHasChanged: boolean

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

Defined in#

models/fields.tsx:82


value#

value: T

Current value of this field

Defined in#

models/fields.tsx:31