type
PluginFieldProps
Values and tools Ridu passes to a plugin’s Svelte field editor.
Component props
| Property | Type | Description |
|---|---|---|
field | PluginFieldBinding< | The current field. Read its unsaved value, validation messages, and read-only state; call set(...) to change it. Ridu supplies and cleans up this connection. |
form | PluginForm | Read other unsaved document values or connect to another editable field with form.bind(path). |
i18n | AdminI18n | Translate interface messages and format dates or numbers using the admin’s language and preferences. |
authoring | FieldAuthoringHost | Open document pickers, fetch a related document, call a Go plugin endpoint, or create a form for fields inside a structured value. |
config | Config | Present only when the registration has decodeConfig. Contains the checked settings returned by that function. |
How it works
Use PluginFieldProps<Value> when reads and writes have the same shape and the editor has no settings. Value describes saved data; Config describes settings; Type defaults to plugin; Input defaults to Value.
Ridu creates these props when it renders the field. Read them with $props() in Svelte; do not construct the field or form objects yourself.
field.set(...) changes the unsaved form. Saving the document is a separate action and runs Go validation.
Full signature
type PluginFieldProps<
Value,
Config = undefined,
Type extends FieldType = "plugin",
Input = Value,
> =
{
/** This editor's field. Read `field.value` and change it with `field.set(...)`. */
field: PluginFieldBinding<Value, Type, Input>;
/** The same document form used by the surrounding fields, including unsaved edits. */
form: PluginForm;
/** Translate interface text and format dates/numbers using the admin's preferences. */
i18n: AdminI18n;
/** Ridu tools for related documents, plugin requests and forms inside structured values. */
authoring: FieldAuthoringHost;
} & ([Config] extends [undefined] ? { config?: never } : { config: Config })