Custom field API
A custom field is registered under a type name in two places: its definition in the plugin's shared module, and its editor and optional view in its client module. The build joins them by name. For a walkthrough, see Create a custom field.
export default (() => ({
fields: { color: { definition } },
})) satisfies SharedPluginModuleexport default (() => ({
fields: {
color: {
editor: () => import('./editor'),
view: () => import('./view'),
},
},
})) satisfies ClientPluginModuleImport FieldDefinition, FieldRendererProps and FieldViewProps from pagescms/plugins/client.
Definition
The definition module's named exports describe the value. It runs on both server and browser: keep it synchronous and free of UI imports, filesystem access, server services and secrets.
read and write receive the repository configuration as config. It's frozen: copy anything you need to modify. They run once per list item, and also inside objects and blocks.
Editor
The editor module's default export is a React component that receives FieldRendererProps:
View
The optional view module's default export renders the value in collection lists. It receives { field, value }. Use the field's configured labels or options rather than assuming the stored value is presentable.
Overriding a built-in type
To replace a built-in type, such as date, register under its name with override: true. Your definition then handles defaults, validation and read/write entirely; built-in conversions don't run first. List wrappers, required and list limits still apply.
Porting a version 2 field
Test ported fields with real data: keyboard use, read-only mode, lists and collection display. The conformance tests in src/lib/custom-field-conformance.test.ts show the expected behavior for defaults, coercion order, overrides and nested read/write.