Socket
Socket
Sign inDemoInstall

@huolala-tech/react-json-view

Package Overview
Dependencies
1
Maintainers
5
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @huolala-tech/react-json-view

A react component for displaying JSON data


Version published
Weekly downloads
125
increased by1.63%
Maintainers
5
Install size
138 kB
Created
Weekly downloads
 

Readme

Source

Engligh | 中文

@huolala-tech/react-json-view

<ReactJsonView /> is a React component for displaying serializable data.

Install

# Yarn
yarn add @huolala-tech/react-json-view

# NPM
npm install @huolala-tech/react-json-view

# pnpm
pnpm install @huolala-tech/react-json-view

Usage

See examples

imoprt React from 'react';
import ReactDOM from 'react-dom';

import ReactJsonView from '@huolala-tech/react-json-view';
import '@huolala-tech/react-json-view/dist/style.css';

const data = [1,2,3,4]

const App = () => {
  return (
    <div id="app">
      <ReactJsonView
        source={data}
        darkMode={false}
        rootLabel="Response data"
        keyCount={200}
        defaultExpand={false}
        maxTitleSize={100}
      />
    </div>
  );
};

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root') as HTMLElement
)

Config

The default configuration usage:

<ReactJsonView
  source={data}
  darkMode={false}
  rootLabel=""
  defaultExpand={false}
  keyCount={200}
  maxTitleSize={100}
  copyable={true}
  expandable={true}
/>
NameTypeDefault valueDescription
sourceobjectNoneOrigin serializable data.
darkModebooleanfalseIndicate whether enable dark mode.
rootLabelReact.ReactNode""Root node's label.
defaultExpandboolean / numberfalseWhether expand property panel. Expand at a particular depth if you pass a integer value.
keyCountnumber / "all"200ReactJsonView supports lazily loading more properties. The parameter indicates how many properties to show at a time, and you can pass "all" to show all properties.
maxTitleSizenumber100The max length of abbreviated title in collapse.
copyablebooleantrueIndicate whether enable copy function.
expandablebooleantrueIndicate whether enable expand function.
stringEllipsebooleantrueEllipse if the string type value's length is more than 100 or show all text when you pass false.

License

MIT

Keywords

FAQs

Last updated on 19 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc