FieldProps
@firecms/core / FieldProps
Interface: FieldProps<T, CustomProps, M>
Section titled “Interface: FieldProps<T, CustomProps, M>”Defined in: types/fields.tsx:12
When building a custom field you need to create a React component that takes this interface as props.
Type Parameters
Section titled “Type Parameters”T extends CMSType = any
CustomProps
Section titled “CustomProps”CustomProps = any
M extends Record<string, any> = any
Properties
Section titled “Properties”autoFocus?
Section titled “autoFocus?”
optionalautoFocus:boolean
Defined in: types/fields.tsx:93
Should this field autofocus on mount
context
Section titled “context”context:
FormContext<M>
Defined in: types/fields.tsx:103
Additional values related to the state of the form or the entity
customProps
Section titled “customProps”customProps:
CustomProps
Defined in: types/fields.tsx:98
Additional properties set by the developer
disabled?
Section titled “disabled?”
optionaldisabled:boolean
Defined in: types/fields.tsx:108
Flag to indicate if this field should be disabled
error?
Section titled “error?”
optionalerror:any
Defined in: types/fields.tsx:56
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
includeDescription?
Section titled “includeDescription?”
optionalincludeDescription:boolean
Defined in: types/fields.tsx:71
Should this field include a description
isSubmitting?
Section titled “isSubmitting?”
optionalisSubmitting:boolean
Defined in: types/fields.tsx:41
Is the form currently submitting
minimalistView?
Section titled “minimalistView?”
optionalminimalistView:boolean
Defined in: types/fields.tsx:88
Display the child properties directly, without being wrapped in an extendable panel. Note that this will also hide the title of this property.
onPropertyChange()?
Section titled “onPropertyChange()?”
optionalonPropertyChange: (property) =>void
Defined in: types/fields.tsx:122
Some properties might change internal state (like expanding a panel). This function should be called when the internal state changes. This is used to preserve state in array containers.
Parameters
Section titled “Parameters”property
Section titled “property”Partial<ArrayProperty<any, any> | MapProperty<any> | AnyProperty>
Returns
Section titled “Returns”void
partOfArray?
Section titled “partOfArray?”
optionalpartOfArray:boolean
Defined in: types/fields.tsx:82
Is this field part of an array
property
Section titled “property”property:
Property<T> |ResolvedProperty<T>
Defined in: types/fields.tsx:66
Property related to this field
propertyKey
Section titled “propertyKey”propertyKey:
string
Defined in: types/fields.tsx:18
Key of the property E.g. “user.name” for a property with path “user.name”
setFieldValue()
Section titled “setFieldValue()”setFieldValue: (
propertyKey,value,shouldValidate?) =>void
Defined in: types/fields.tsx:36
Set value of a different field directly
Parameters
Section titled “Parameters”propertyKey
Section titled “propertyKey”string
CMSType | null
shouldValidate?
Section titled “shouldValidate?”boolean
Returns
Section titled “Returns”void
setValue()
Section titled “setValue()”setValue: (
value,shouldValidate?) =>void
Defined in: types/fields.tsx:28
Set value of field directly
Parameters
Section titled “Parameters”T | null
shouldValidate?
Section titled “shouldValidate?”boolean
Returns
Section titled “Returns”void
showError?
Section titled “showError?”
optionalshowError:boolean
Defined in: types/fields.tsx:49
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.
optionalsize:"small"|"medium"|"large"
Defined in: types/fields.tsx:113
Size of the field
touched?
Section titled “touched?”
optionaltouched:boolean
Defined in: types/fields.tsx:61
Has this field been touched
underlyingValueHasChanged?
Section titled “underlyingValueHasChanged?”
optionalunderlyingValueHasChanged:boolean
Defined in: types/fields.tsx:77
Flag to indicate that the underlying value has been updated in the datasource
value:
T
Defined in: types/fields.tsx:23
Current value of this field