---
title: "TypeScript Types for Vue 3 Editor"
description: "Typed props, emits, and exposed methods for @erag/text-editor-vue: EditorProps, EditorEmits, EditorInstance for template refs, and feature types."
head:
- - meta
- name: robots
content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1'
- - meta
- name: googlebot
content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1'
- - meta
- name: bingbot
content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1'
---
Are you an LLM? You can read better optimized documentation at https://raw.githubusercontent.com/eramitgupta/erag/main/text-editor-vue/docs/types.md
# TypeScript Types for the Vue 3 Editor
`@erag/text-editor-vue` publishes declaration files with its ESM build, so `
```
### `EditorMenuName`
```ts
type EditorMenuName =
| 'file'
| 'edit'
| 'view'
| 'insert'
| 'merge-tags'
| 'templates'
| 'format'
| 'tools'
| 'table'
| 'help';
const menus: EditorMenuName[] = ['file', 'edit', 'insert', 'help'];
```
### `EditorPluginName`
Plugin names identify supported editor capabilities. An explicit array filters plugin-backed controls; core history, formatting, and list controls are still selected through `toolbar` and `menubar`.
```ts
const plugins: EditorPluginName[] = [
'history',
'formatting',
'lists',
'link',
'image',
'media',
'table',
'code',
'preview',
'fullscreen',
'find-replace',
'special-character',
'emoji',
'horizontal-rule',
'anchor',
'merge-tags',
'templates',
'date-time',
];
```
### `EditorToolbarGroup`
The array form and string form use the same toolbar renderer.
```ts
const toolbar: EditorToolbarGroup[] = [
{ name: 'history', items: ['undo', 'redo'] },
{ name: 'text', items: ['bold', 'italic', 'underline'] },
{ name: 'insert', items: ['link', 'image', 'table'] },
];
```
Valid item names are: `undo`, `redo`, `blocks`, `fontfamily`, `fontsize`, `lineheight`, `bold`, `italic`, `underline`, `strikethrough`, `superscript`, `subscript`, `casechange`, `forecolor`, `backcolor`, `alignment`, `alignleft`, `aligncenter`, `alignright`, `alignjustify`, `bullist`, `numlist`, `checklist`, `outdent`, `indent`, `link`, `image`, `media`, `table`, `hr`, `removeformat`, `code`, `preview`, `fullscreen`, and `more`.
## Mention types
```ts
interface MentionItem {
id: string | number;
label: string;
description?: string;
avatar?: string;
value?: string;
}
interface MentionConfig {
enabled?: boolean;
minimumCharacters?: number;
debounce?: number;
limit?: number;
items?:
| MentionItem[]
| ((
query: string,
signal: AbortSignal,
) => MentionItem[] | Promise);
}
```
`MentionItem` intentionally has no arbitrary metadata field. Keep application-specific data outside the editor item.
```ts
const mention: MentionItem = {
id: 7,
label: 'Amit Gupta',
description: 'Senior Software Developer',
value: 'amit@example.com',
};
const searchEvent: MentionSearchEvent = { query: 'am' };
const selectEvent: MentionSelectEvent = { item: mention, query: 'am' };
const removeEvent: MentionRemoveEvent = { item: mention };
```
## Merge-tag types
```ts
interface MergeTagItem {
value: string;
name?: string;
group?: string;
}
interface MergeTagConfig {
enabled?: boolean;
limit?: number;
items?: MergeTagItem[];
}
const tag: MergeTagItem = {
value: '{{client.name}}',
name: 'Client name',
group: 'Client',
};
const selected: MergeTagSelectEvent = { item: tag, query: 'client' };
const removed: MergeTagRemoveEvent = { item: tag };
```
The optional `name` is a friendly label for autocomplete and sidebar lists. The normalized wrapped `value` remains the inserted token and both fields are included in select/remove events when available.
## Template types
```ts
interface EditorTemplateItem {
id: string | number;
label: string;
content: string;
group?: string;
description?: string;
}
interface EditorTemplatesConfig {
enabled?: boolean;
items?: EditorTemplateItem[];
}
const template: EditorTemplateItem = {
id: 'follow-up',
label: 'Follow-up message',
description: 'A short follow-up for a client.',
group: 'Quick replies',
content: 'Hello {{client.name}},
Just checking in.
',
};
const event: TemplateInsertEvent = { item: template };
```
## Image types
```ts
interface ImageBlobInfo {
id(): string;
name(): string;
filename(): string;
blob(): Blob;
base64(): string;
blobUri(): string;
}
type ImagesUploadHandler = (
blobInfo: ImageBlobInfo,
progress: (percentage: number) => void,
) => Promise;
```
```ts
interface ImageDeleteInfo {
src: string;
alt: string;
width: number;
height: number;
}
type ImagesDeleteHandler = (image: ImageDeleteInfo) => void | Promise;
const removeImage: ImagesDeleteHandler = async (image) => {
await fetch('/api/editor-images', {
method: 'DELETE',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ src: image.src }),
});
};
```
The delete callback receives rendered dimensions. The editor emits the same `ImageDeleteInfo` only after removal succeeds.