diff --git a/src/types/schema.ts b/src/types/schema.ts index 9d340ffa8..f416e6a40 100644 --- a/src/types/schema.ts +++ b/src/types/schema.ts @@ -47,14 +47,21 @@ export interface ContentConfig { } export interface EditorOptions { - input?: 'media' | 'icon' | 'textarea' // Override the default input for the field + input?: 'media' | 'icon' | 'textarea' | 'relation' // Override the default input for the field hidden?: boolean // Do not display the field in the editor iconLibraries?: string[] // List of icon libraries to use for the icon input + relation?: RelationOptions // Collection referenced by the field, for the relation input label?: string // Override auto-generated label with a custom one description?: string // When defined, set a description for the field tooltip?: string // When defined, set a tooltip info-bubble next to the label } +export interface RelationOptions { + collection: string // Name of the referenced collection, as declared in the content config + valueField?: 'slug' | 'path' | 'stem' | (string & {}) // Field of the referenced document written to the file, defaults to `slug` (its file name) + labelField?: string // Field of the referenced document displayed in the editor, defaults to `name` then `title` +} + export interface ContentStandardSchemaV1 extends StandardSchemaV1 { $content?: ContentConfig }