Skip to content

Theming ​

v3-jsoneditor ships a modern look on top of jsoneditor, with matching styling for the menu bar, tree, Ace code editor and modals.

The theme prop ​

ValueDescription
lightModern light theme. Default.
darkModern dark theme, including dark styling for the Ace code editor.
autoFollows the page: dark when an ancestor html element has the dark class (VitePress, Nuxt Color Mode, Tailwind darkMode: 'class'), otherwise follows the operating system's prefers-color-scheme.
classicThe original jsoneditor look (blue menu bar), as in v3-jsoneditor 0.0.x.
vue
<Vue3Jsoneditor v-model="json" theme="dark" />
<Vue3Jsoneditor v-model="json" theme="auto" />
<Vue3Jsoneditor v-model="json" theme="classic" />

CSS variables ​

The modern themes (light, dark, auto) are driven by CSS custom properties on the .v3-jsoneditor root element. Override any of them to match your brand.

VariablePurpose
--vje-accentAccent color: menu highlights, active mode, focus rings, selection.
--vje-bgEditor background.
--vje-surfaceMenu bar, navigation bar and status bar background.
--vje-borderBorder and divider color.
--vje-textMain text color.
--vje-mutedSecondary text: field names, line numbers, placeholders.
--vje-radiusCorner radius of the editor and its controls.
--vje-font-monoMonospace font used in tree, code and text modes.
--vje-shadowShadow of the editor container, menus and modals.
--vje-z-fullscreenz-index of the editor in fullscreen mode.

Global overrides ​

Apply to every editor on the page:

css
.v3-jsoneditor {
  --vje-accent: #10b981;
  --vje-radius: 12px;
  --vje-font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

Scoped overrides ​

Add a class to a single editor and override variables only there:

vue
<template>
  <Vue3Jsoneditor v-model="json" class="brand-editor" />
</template>

<style>
.brand-editor.v3-jsoneditor {
  --vje-accent: #e11d48;
  --vje-surface: #fff1f2;
  --vje-border: #fecdd3;
}
</style>

Classes set on the component are applied to its root element, the same element that carries .v3-jsoneditor. Combine both classes (.brand-editor.v3-jsoneditor) so your values win over the built-in theme regardless of stylesheet order, with no !important needed.

TIP

For a dark variant of a custom palette, scope your values under the dark theme too, for example html.dark .brand-editor { ... } when you use theme="auto".

See the Custom theme example for a live demo.

Dark Ace editor ​

In code mode, jsoneditor uses the Ace editor. The modern themes restyle jsoneditor's default Ace theme with the same CSS variables (gutter, active line, selection, cursor and JSON token colors), so dark and auto give you a dark code editor without loading anything extra. To use a different Ace theme, set options.theme (for example options: { theme: 'ace/theme/monokai' }) and load that theme yourself. The component's color overrides only apply to the default theme.

Toolbar icons ​

The modern themes replace jsoneditor's sprite icons in the menu bar with crisp Solar icons that pick up --vje-text and --vje-accent. The classic theme keeps jsoneditor's original sprite.

CSS delivery and CSP ​

In the ESM build, the theme CSS is injected automatically by JavaScript, so there is nothing to import. For CDN or strict Content Security Policy setups, dist/style.css is also published and can be linked as a regular stylesheet.

Going further ​

Need more than variables? All jsoneditor class names (.jsoneditor, .jsoneditor-menu, .jsoneditor-tree, ...) are still present, so you can target them with regular CSS scoped under your own class.

Released under the MIT License.