0.1.3 • Published 1 year ago

lite-json-editor v0.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

lite-json-editor (Vue 3)

A lightweight json formatter/editor for Vue 3

Demo

The San Juan Mountains are beautiful!

Install

Vue 3

npm i lite-json-editor

Usage

<script setup>
    import { ref } from 'vue'
    import LiteJsonEditor from 'lite-json-editor'

    const value = ref()
</script>

<template>
    <LiteJsonEditor v-model="value" />
</template>

Props

NameDescriptionTypeDefault
v-modelbinding valueObject, String, null
indentjson indentNumber3
darkdark modeBooleanfalse
withoutEditdisable editingBooleanfalse
withoutErrordisable error triggerBooleanfalse
formattingcolor formattingObject

Slots

This component provides a slot if you need to modify the error display behavior

<template>
    <LiteJsonEditor v-model="value">
        <img src="/example-error-icon.svg" />
    </LiteJsonEditor>
</template>

Formatting

Default colors are

  • #a9dc76 #a9dc76 - number
  • #84aecc #84aecc - braces
  • #d26a6a #d26a6a - brackets
  • #4f4f4f #4f4f4f - colon
  • #f8c33b #f8c33b - comma
  • #5f9fca #5f9fca - string
  • #e393ff #e393ff - string_quotes
  • #ff6188 #ff6188 - key
  • #fc9867 #fc9867 - key_quotes
  • #cccccc #cccccc - null
  • #8ccf79 #8ccf79 - true
  • #e69fc2 #e69fc2 - false

If you want to modify any of those values pass a formatting object containing key: color pairs of your desired changes

<template>
    <LiteJsonEditor v-model="value" :formatting="{ 'number': '#e3e3e3' }" />
</template>