---
title: "Vue Editor Props, Events and Slots"
description: "Look up the Vue 3 Editor API: modelValue for v-model, readonly and disabled props, emitted events, named slots, and methods exposed through a template ref."
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/api.md
# Vue 3 API reference: props, emits, slots, and exposed methods
In a Vue template, `Editor` works like any other component: bind content with `v-model`, listen with `@` handlers, fill named slots, and call exposed methods through `useTemplateRef`. The snippets use `', {
allowedTags: ['p'],
allowedAttributes: {},
allowRelativeUrls: true,
});
```
## Props (`EditorProps`)
| Prop | Type | Default | Description |
| ------------ | ------------ | -------------------- | ------------------------------------------------------------------------------------------ |
| `modelValue` | `string` | `''` | HTML controlled by `v-model`. |
| `init` | `EditorInit` | package defaults | Partial editor configuration. It is normalized reactively and is not mutated. |
| `disabled` | `boolean` | `false` | Disables editing and editor actions. |
| `readonly` | `boolean` | `false` | Prevents content changes while keeping safe viewing actions available. |
| `id` | `string` | — | Applied to the editable content element. |
| `name` | `string` | — | Adds a hidden form input containing the current HTML. |
| `ariaLabel` | `string` | `'Rich text editor'` | Accessible label for the editing surface. In templates, use `aria-label` or `:aria-label`. |
```vue
```
## Events (`EditorEmits`)
| Event | Payload | When it is emitted |
| ------------------- | --------------------- | ----------------------------------------------------------------- |
| `update:modelValue` | `string` | HTML actually changed. Duplicate model updates are not emitted. |
| `click` | `MouseEvent` | The editable area is clicked. |
| `focus` | `FocusEvent` | The editable area receives focus. |
| `blur` | `FocusEvent` | The editable area loses focus. |
| `input` | `InputEvent` | A native editor input is handled. |
| `change` | `string` | On blur, when HTML changed since the previous committed value. |
| `keydown` | `KeyboardEvent` | A key is pressed in the editor. |
| `paste` | `ClipboardEvent` | A paste action is handled. |
| `ready` | `HTMLElement` | The editable root is connected on the client. |
| `selection-change` | `Selection` | The browser selection changes while the editor is active. |
| `resize` | `{ height: number }` | The bottom resize handle changes editor height. |
| `mention-search` | `MentionSearchEvent` | A debounced mention search starts. |
| `mention-select` | `MentionSelectEvent` | A mention is inserted. |
| `mention-remove` | `MentionRemoveEvent` | A complete mention token is removed. |
| `merge-tag-select` | `MergeTagSelectEvent` | A merge tag is inserted. |
| `merge-tag-remove` | `MergeTagRemoveEvent` | A complete merge-tag token is removed. |
| `template-insert` | `TemplateInsertEvent` | A configured template is inserted. |
| `image-remove` | `ImageDeleteInfo` | An image is removed after any configured delete handler succeeds. |
```vue
console.log(height)"
@image-remove="handleImageRemove"
/>
```
## Exposed methods (`EditorInstance`)
Use a typed template ref when another control needs to call the editor directly.
```vue
```
| Method | Result | Description |
| ------------------- | --------------------- | ------------------------------------------------------ |
| `focus()` | `void` | Focuses the editable area. |
| `blur()` | `void` | Removes focus from it. |
| `getHtml()` | `string` | Returns current normalized HTML. |
| `setHtml(value)` | `void` | Replaces content and publishes the change. |
| `getText()` | `string` | Returns plain text. |
| `clear()` | `void` | Replaces content with an empty string. |
| `insertHtml(value)` | `void` | Sanitizes and inserts HTML at the saved selection. |
| `insertText(value)` | `void` | Escapes and inserts plain text. |
| `selectAll()` | `void` | Selects the editor content. |
| `undo()` / `redo()` | `void` | Moves through editor history when possible. |
| `openSourceCode()` | `void` | Opens the source-code dialog. |
| `openPreview()` | `void` | Opens the preview dialog. |
| `getRootElement()` | `HTMLElement \| null` | Returns the editable root, not the outer editor shell. |
The `openSourceCode()` and `openPreview()` methods open the dialogs covered in [code, preview, and fullscreen](./code-and-preview.html).
## Slots
| Slot | Props | Purpose |
| ----------------- | ------------------ | ------------------------------------------------------ |
| `toolbar-start` | — | Content before toolbar groups. |
| `toolbar-end` | — | Content after toolbar groups. |
| `menubar-end` | — | Content at the end of the menubar. |
| `statusbar-start` | — | Content before the status information. |
| `statusbar-end` | — | Content after the status information. |
| `empty` | — | Custom empty-state content inside the editable canvas. |
| `mention-item` | `{ item, active }` | Custom mention result rendering. |
| `mention-loading` | `{ query }` | Custom mention loading state. |
| `mention-empty` | `{ query }` | Custom mention empty state. |
| `mention-error` | `{ query, retry }` | Custom mention error state. |
Slots add presentation only; editor keyboard handling and selection management remain internal.