type

FieldEditorProps

The current value, validation messages, and tools passed to an application’s custom field input.

Component props

PropertyTypeDescription
fieldFieldBinding<Type>The current input value and controls. Read value, show issues, check readOnly, spread inputProps onto the control, and call set(...) to update the unsaved form.
formFieldEditorProps<Type, Config>["form"]Read other fields with get(path), their issues with issuesFor(path), and the current resource or contentLocale. Application editors change only their own field; this form does not provide bind.
i18nAdminI18nTranslate interface messages and format dates or numbers with the admin’s language and preferences.
authoringFieldEditorProps<Type, Config>["authoring"]Browse or fetch related documents with collections, referenceBrowser, findDocument, documentRevision, and locale. It does not expose Go plugin requests or embedded-form creation.
configConfigPresent only when defineFieldEditor supplies decodeConfig. Contains the checked settings returned from the Go field’s component configuration.

How it works

Use FieldEditorProps<"text"> for a text input. Match the literal type in defineFieldEditor and the field type in Go. Add a second type argument for settings only when the registration has decodeConfig.

Ridu keeps the field connected to the same array or block row when it moves. If delayed work finishes after the field becomes stale, discard its result.

The Field component from @riducms/plugin/editor/field supplies the label, description, and errors. Spread field.inputProps onto the input to associate those elements correctly.

Full signature

type FieldEditorProps<Type extends FieldEditorType = FieldEditorType, Config = undefined> = { /** Read the current value and update it with `field.set(...)`. */ field: FieldBinding<Type>; /** Interface translations and formatting using the admin's language/preferences. */ i18n: AdminI18n; /** * Read other values in this unsaved document form. These methods return copies * and expire with the editor. Local editors update only their own `field`; * this form interface does not expose `bind` for writing another field. */ form: Pick<FieldDocumentForm, "contentLocale" | "resource" | "get" | "issuesFor"> & Partial<Pick<FieldDocumentForm, "snapshot">>; /** * Browse or fetch related documents. These are the local editor's available tools; * a local editor mounted in an embedded form reads and writes that forms detached payload. * The containing paired plugin owns Apply/Cancel and Go plugin requests. */ authoring: Pick< FieldAuthoringHost, "collections" | "documentRevision" | "referenceBrowser" | "findDocument" > & { readonly locale: string | undefined }; } & ([Config] extends [undefined] ? { config?: never } : { /** Go settings validated by the registration's decoder before rendering. */ config: Config; })

Source packages/plugin/src/editor/index.ts:1

Related types

  • FieldEditorType

    Field types whose inputs you can replace with a custom component. Lists contain primitive strings or numbers; the list is one field.

Related guides