Skip to content

Props ​

All props of <Vue3Jsoneditor>. In templates, use kebab-case (current-mode) or camelCase (currentMode); both work.

PropTypeDefaultDescription
modelValueobject | array | string | number | boolean | nullundefinedThe JSON value. Use with v-model.
optionsobject{}Passed to the jsoneditor constructor. Accepts any jsoneditor option. Callbacks are merged with the component's own. options.schema is reactive.
textstringundefinedRaw editor text. Use with v-model:text. May be invalid JSON while the user types. If provided initially, it wins over modelValue.
currentMode'tree' | 'code' | 'form' | 'text' | 'view''code'Active editor mode. Supports v-model:currentMode.
modeListstring[]['tree', 'code', 'form', 'text', 'view']Modes offered in the mode switcher. Changing it re-creates the editor.
languagestring'en'UI language: en, zh-CN, pt-BR, tr, ja, fr-FR, de, ru, es. Changing it re-creates the editor.
heightstring | numberundefinedEditor height. A number is treated as pixels; a string is any CSS length ('400px', '50vh'). Without it, the editor fills its parent.
plusbooleantrueShow the fullscreen button in the menu bar (all modes).
fullscreenbooleanfalseFullscreen state. Supports v-model:fullscreen.
readOnlybooleanfalseMake the editor read-only in all modes (implemented with jsoneditor's onEditable).
debouncenumber0Debounce in milliseconds for update:modelValue, update:text and change. 150 to 300 is recommended for large documents.
mainMenuBarbooleantrueShow the main menu bar.
navigationBarbooleantrueShow the navigation bar (breadcrumbs) in tree/view/form modes.
statusBarbooleantrueShow the status bar (cursor position, size) in code/text modes.
indentationnumber2Spaces used to indent formatted JSON. Wins over options.indentation.
theme'light' | 'dark' | 'auto' | 'classic''light'Visual theme. auto follows the html.dark class or prefers-color-scheme; classic is the original jsoneditor look.

Option precedence ​

When a setting can come from more than one place: component props > options > component defaults.

SettingSource
ModecurrentMode prop (always set; default 'code').
Available modesmodeList prop.
Languagelanguage prop.
Indentationindentation prop, then options.indentation, then 2.
Menu/navigation/status barsmainMenuBar / navigationBar / statusBar props (default true), then the matching options keys.
Callbacks (onChange, onModeChange, onFocus, ...)Both the component's handler and yours run.

See Usage: passing jsoneditor options.

Global defaults ​

app.use(Vue3Jsoneditor, config) accepts defaults for every prop. All keys except componentName are defaults for the matching prop; options from the global config and from the component are merged (local wins).

KeyTypeDefaultDescription
componentNamestring'Vue3Jsoneditor'Name the component is registered under.
any prop name (theme, height, debounce, language, ...)prop typeprop defaultDefault value for that prop.
optionsobject{}Default jsoneditor options, merged with the options prop.
js
app.use(Vue3Jsoneditor, {
  componentName: 'JsonEditor',
  theme: 'auto',
  height: 500,
  debounce: 200,
  options: { search: false },
})

Slots ​

default ​

Placeholder content rendered until the editor has mounted, for example a loading message or skeleton. Useful with SSR, where the editor only appears on the client.

vue
<Vue3Jsoneditor v-model="json" height="400px">
  <div class="skeleton">Loading editor...</div>
</Vue3Jsoneditor>

toolbar ​

Custom content rendered inside the jsoneditor menu bar, on the right side. It is re-attached automatically when the mode changes (jsoneditor rebuilds its menu bar on mode switch).

Slot propTypeDescription
editorJSONEditor | nullThe raw jsoneditor instance.
modestringThe current mode.
vue
<script setup>
import { ref } from 'vue'
import Vue3Jsoneditor from 'v3-jsoneditor'

const json = ref({ hello: 'world' })
const copy = (editor) =>
  navigator.clipboard.writeText(JSON.stringify(editor.get(), null, 2))
</script>

<template>
  <Vue3Jsoneditor v-model="json">
    <template #toolbar="{ editor, mode }">
      <button type="button" :title="`Copy (${mode})`" @click="copy(editor)">Copy</button>
    </template>
  </Vue3Jsoneditor>
</template>

See the Custom toolbar example.

CSS variables ​

Styling is controlled with --vje-* CSS variables on .v3-jsoneditor (--vje-accent, --vje-bg, --vje-surface, --vje-border, --vje-text, --vje-muted, --vje-radius, --vje-font-mono, --vje-shadow, --vje-z-fullscreen). See Theming for descriptions.

Released under the MIT License.