1.0.0 • Published 9 months ago

@hiimdjango/json-editor-react v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

React Json Edit

React-based visual json editor.

npm.io

Getting Started

Install

npm i react-json-editor-ui -S

Props

keydescriptionrequireddefault
widthThe container widthfalse500
dataThe editor uses datatruenull
onChangeCallback the datatruenull
optionsMapWhen a match for auto-complete on the input valuefalsenull

Example:

import * as React from 'react'
import * as ReactDOM from 'react-dom'
import JsonEditor from 'react-json-editor-ui'
import 'react-json-editor-ui/dist/react-json-editor-ui.cjs.development.css'

const App = () => {
  const [editObject, setEditObject] = React.useState<any>({
    name: 'may',
    age: null,
    address: [
      'Panyu Shiqiao on Canton',
      'Tianhe',
      {
        city: 'forida meta 11',
      },
    ],
    others: {
      id: 1246,
      joinTime: '2017-08-20. 10:20',
      description: 'another',
    },
  })

  return (
    <JsonEditor
      data={editObject}
      onChange={data => {
        setEditObject(data)
      }}
      optionsMap={{
        color: [
          { value: 'red', label: 'Red' },
          { value: 'blue', label: 'Blue' },
        ],
        city: [
          { value: 'beijing', label: 'Beijing' },
          { value: 'shanghai', label: 'Shanghai' },
        ],
      }}
    />
  )
}
export default App

License

MIT

Copyright (c) 2013-present

1.0.0

9 months ago