rbh-connect-tree
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

rbh connect tree

intro

a simple react component based on jsplumb for displaying tree-structure data.

install

npm install rbh-connect-tree

usage

Datasource

The datasource should be tree-structure containing two properties: data: any and children: any[]. for example:

const datasource = {
  data: 'layer1-1',
  children: [
    {
      data: 'layer2-1',
      children: [
        {
          data: 'layer3-1',
          children: []
        }
      ]
    },
    {
      data: 'layer2-2'
      children: []
    }
  ]
}

// ...
<ConnectTree dataSource={dataSource}/>

Option

TODO

Example

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import ConnectTree, { randomGeneratesTree } from 'rbh-connect-tree';

const App = () => {
  const [dataSource, setDataSource] = React.useState(randomGeneratesTree(4, 100, 2));

  return (
    <div>
      <ConnectTree
        style={{ height: '100vh', width: '100vw'}}
        dataSource={dataSource}
      />
    </div>
  );
};

ReactDOM.render(<App />, document.getElementById('root'));

Readme

Keywords

Package Sidebar

Install

npm i rbh-connect-tree

Weekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

111 kB

Total Files

17

Last publish

Collaborators

  • rainbowhow