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
Textends CMSType
CustomPropsany
Mextends 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


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


shouldAlwaysRerender

โ€ข shouldAlwaysRerender: boolean

Flag to indicate if this field should rerender on any state change. This is important for fields that are built from a PropertyBuilder where the fields might change based on the values of the form.

Defined in

models/fields.tsx:119


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

Methods

setValue

โ–ธ setValue(value, shouldValidate?): void

Set value of field directly

Parameters

NameType
valuenull | T
shouldValidate?boolean

Returns

void

Defined in

models/fields.tsx:41