Skip to main content
Version: 2.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 = CMSType
CustomPropsany
Mextends Record<string, any> = any

Properties

autoFocus

autoFocus: boolean

Should this field autofocus on mount

Defined in

lib/src/types/fields.tsx:96


context

context: FormContext<M>

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

Defined in

lib/src/types/fields.tsx:106


customProps

customProps: CustomProps

Additional properties set by the developer

Defined in

lib/src/types/fields.tsx:101


disabled

disabled: boolean

Flag to indicate if this field should be disabled

Defined in

lib/src/types/fields.tsx:111


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

lib/src/types/fields.tsx:60


includeDescription

includeDescription: boolean

Should this field include a description

Defined in

lib/src/types/fields.tsx:75


initialValue

initialValue: undefined | T

Initial value of this field

Defined in

lib/src/types/fields.tsx:27


isSubmitting

isSubmitting: boolean

Is the form currently submitting

Defined in

lib/src/types/fields.tsx:45


partOfArray

partOfArray: boolean

Is this field part of an array

Defined in

lib/src/types/fields.tsx:86


property

property: ResolvedProperty<T>

Property related to this field

Defined in

lib/src/types/fields.tsx:70


propertyKey

propertyKey: string

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

Defined in

lib/src/types/fields.tsx:17


setFieldValue

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

Type declaration

▸ (propertyKey, value, shouldValidate?): void

Set value of a different field directly

Parameters
NameType
propertyKeystring
valuenull | CMSType
shouldValidate?boolean
Returns

void

Defined in

lib/src/types/fields.tsx:40


setValue

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

Type declaration

▸ (value, shouldValidate?): void

Set value of field directly

Parameters
NameType
valuenull | T
shouldValidate?boolean
Returns

void

Defined in

lib/src/types/fields.tsx:32


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

lib/src/types/fields.tsx:53


tableMode

tableMode: boolean

Is this field being rendered in the table

Defined in

lib/src/types/fields.tsx:91


touched

touched: boolean

Has this field been touched

Defined in

lib/src/types/fields.tsx:65


underlyingValueHasChanged

underlyingValueHasChanged: boolean

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

Defined in

lib/src/types/fields.tsx:81


value

value: T

Current value of this field

Defined in

lib/src/types/fields.tsx:22

Enterprise or start-up?

Learn how to get the most out of your project with the help of our consulting team.
Learn more
Sign up to our newsletter to get the latest news and updates. No spam!