registerEditorItem
Binds a string type to a Vue component in the global editor registry. Any editor item with comp: type then renders that component. Call once at module load before instantiating any <Editor>.
Usage
registerEditorItem(type: string, handler: Component<any>): void;
| Argument | Type | Description |
|---|---|---|
type | string | Identifier referenced by editor items via comp |
handler | Component<any> | Vue component to render for that type |
Example
Register a third-party field component, then reference it in an editor item:
import { registerEditorItem } from "@svar-ui/vue-calendar";
import { Comments } from "@wx/vue-comments";
registerEditorItem("comments", Comments);
<script setup lang="ts">
import { Editor, getEditorItems } from "@svar-ui/vue-calendar";
const items = [
...getEditorItems(),
{ comp: "comments", key: "comments", label: "Comments", users, activeUser },
];
</script>
<template>
<Editor :api="api" :items="items" />
</template>
Calling with an existing type id ("text", "date-time-picker", "checkbox") replaces the built-in renderer for every Editor instance in the app.
Related articles
getEditorItems— reuse default fields alongside custom ones.Editor— companion that consumes the registered types.- Editing — patterns for extending the editor.