Component
Vue WYSIWYG Editor Field
<DomWysiwyg>A textarea-shaped rich text field powered by DomDocumentEditor, with headings, language-aware highlighted code blocks, tables, simple v-model wiring, and no collaboration or AI review rail by default.
Playground
Try every prop live
WYSIWYG field playground
Adjust the props to explore sizing, content, and behaviour.
Properties
Control props
Attrs
Attrs
Controlled editor content. JSON is preferred; HTML strings are accepted for simple imports.
Value emitted through update:modelValue.
Accessible editor title. Defaults to the field label.
Optional save or validation status label.
Built-in toolbar tool ids to show.
Additional toolbar actions emitted through tool-action.
Minimum height for the editable field.
Field props
Optional ID override. By default parent forms derive the input ID from the field path using underscores.
Local field name. Parent forms derive the full field path and native HTML name from the form hierarchy.
Visible field label.
Optional helper copy below the field.
Placeholder shown when the control is empty.
Validation errors for this field.
Validators
No validators yet.
Validators attached to this field. Use functions in Vue code, or serializable records such as { name: "minLength", props: { min: 2 } } in generated schemas.
Render default field chrome, or hide chrome while keeping form state wiring.
npm install @getdom/studio<script setup>
import '@getdom/studio/style.css';
import { reactive } from 'vue';
import { DomWysiwyg } from '@getdom/studio';
const data = reactive({
"modelValue": {
"type": "doc",
"content": [
{
"type": "heading",
"attrs": {
"level": 1
},
"content": [
{
"type": "text",
"text": "Customer launch note"
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "The July release gives teams one place to draft product copy, review AI suggestions, and keep the final document structured for publishing."
}
],
"attrs": {
"level": ""
}
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "The current draft needs a warmer introduction, a shorter benefits section, and one image from the product media library before it is ready to share."
}
],
"attrs": {
"level": ""
}
}
]
},
"id": "",
"name": "",
"label": "",
"description": "",
"placeholder": "",
"required": false,
"disabled": false,
"readOnly": false,
"invalid": false,
"errors": [],
"visible": true,
"validators": [],
"validateOnBlur": true,
"chrome": "field",
"output": "json",
"editable": true,
"title": "",
"status": "",
"tools": [
"undo",
"redo",
"paragraph",
"heading1",
"heading2",
"heading3",
"bold",
"italic",
"underline",
"bulletList",
"orderedList",
"blockquote",
"codeBlock",
"link",
"table"
],
"customTools": [],
"showToolbar": true,
"showSlashMenu": true,
"minHeight": "16rem"
});
</script>
<template>
<DomWysiwyg
v-bind="data"
@update:modelValue="data.modelValue = $event"
/>
</template>Reference
Props
Control props
| Name | Type | TS | Default | Description |
|---|---|---|---|---|
modelValue | object | string | Record<string, unknown> | () => … | Controlled editor content. JSON is preferred; HTML strings are accepted for simple imports. |
output | 'json' | 'html' | string | 'json' | Value emitted through update:modelValue. |
editable | boolean | boolean | true | Allow editing and toolbar commands. |
title | string | string | '' | Accessible editor title. Defaults to the field label. |
status | string | string | '' | Optional save or validation status label. |
tools | array | Array<unknown> | () => … | Built-in toolbar tool ids to show. |
customTools | array | Array<unknown> | [] | Additional toolbar actions emitted through tool-action. |
showToolbar | boolean | boolean | true | Show the WYSIWYG toolbar. |
showSlashMenu | boolean | boolean | true | Open the block command menu when the user types / at the start of a block. |
minHeight | string | string | '16rem' | Minimum height for the editable field. |
Field props
| Name | Type | TS | Default | Description |
|---|---|---|---|---|
id | string | string | '' | Optional ID override. By default parent forms derive the input ID from the field path using underscores. |
name | string | string | '' | Local field name. Parent forms derive the full field path and native HTML name from the form hierarchy. |
label | string | string | '' | Visible field label. |
description | string | string | '' | Optional helper copy below the field. |
placeholder | string | string | '' | Placeholder shown when the control is empty. |
required | boolean | boolean | false | Mark the field as required. |
disabled | boolean | boolean | false | Disable field interaction. |
readOnly | boolean | boolean | false | Show the value but prevent editing. |
invalid | boolean | boolean | false | Mark the field invalid. |
errorsts | array | object | string | Array< | [] | Validation errors for this field. |
visible | boolean | boolean | true | Show or hide the field. |
validators | array | Array<unknown> | [] | Validators attached to this field. Use functions in Vue code, or serializable records such as { name: "minLength", props: { min: 2 } } in generated schemas. |
validateOnBlur | boolean | boolean | true | Run validators when the field loses focus. |
chrome | 'field' | 'none' | false | string | 'field' | Render default field chrome, or hide chrome while keeping form state wiring. |
Auto-generated from WYSIWYG field.props and inline _edit hints.
Events
| Name | Payload | Description |
|---|---|---|
| @update:modelValue | Record<string, unknown> | string | Fired with JSON or HTML content depending on the output prop. |
| @change | DocumentEditorChangePayload | Fired with JSON, HTML, and plain text whenever the editor changes. |
| @selection-change | DocumentEditorSelectionPayload | Fired when the editor selection changes. |
| @tool-action | ({ tool, editor }) | Fired when a custom toolbar tool is activated. |
| @ready | ({ editor }) | Fired after the browser-only editor runtime mounts. |
| @runtime-error | Error | Fired when the editor runtime cannot mount. |
| @focus | FocusEvent | Fired when the editable document receives focus. |
| @blur | FocusEvent | Fired when the editable document loses focus. |
Names auto-detected from defineEmits and source emit() calls; payload and description from __doc.events when present.