Skip to main content
Version: 1.0.0

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