Skip to content

Custom Toolbar ​

The #toolbar slot renders your own content inside jsoneditor's menu bar, on the right. It receives { editor, mode }, where editor is the raw jsoneditor instance, so editor.get() returns the current JSON. The slot is re-attached automatically whenever the mode changes.

Custom toolbar

Notes ​

  • editor.get() throws when the text in code/text mode is not valid JSON. Wrap it in try/catch if you want to show a friendly message, or use editor.getText() to export the raw text.
  • Use mode from the slot props to show buttons only in some modes, for example v-if="mode === 'code'".

See Slots in the API reference.

Released under the MIT License.