1.1.3 • Published 12 months ago

react-matrix-tree v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

React-Matrix-Tree

React-matrix-tree allows you to create tree view with different types of matrix.

Installation

$ npm install --save react-matrix-tree
$ yarn add react-matrix-tree

import { Tree } from 'react-matrix-tree'
import 'react-matrix-tree/dist/react-matrix-tree.css';

Features

  • Easy to set up for real, you can make it work in less than 1minute!
  • Super easy to customize
  • Can choose matrix type
  • Can display a html content as tooltip
  • Has onClick hooks. Can pass onclick event when user interact
  • Display information using tooltip When user hovers on.
  • You can display dynamic image using imageSource.
  • For Responsive design you have to pass a prop isMobile.
  • And much more !

The gist

One Matrix

import React from 'react'

import { Tree } from 'react-matrix-tree';
import 'react-matrix-tree/dist/react-matrix-tree.css';

function App() {
  const data = [{ title: 'Title' }]

  return (
    <div>
      <Tree color='red' data={data} isMobile={false} />
    </div>
  )
}

Two Matrix

import React from 'react'

import { Tree } from 'react-matrix-tree';
import 'react-matrix-tree/dist/react-matrix-tree.css';

function App() {
  const data = [{ title: 'Title', data: [{ title: 'Title' }, { title: 'Title' }] }]

  return (
    <div>
      <Tree color='red' data={data} isMobile={false} />
    </div>
  )
}

Three Matrix

import React from 'react'

import { Tree } from 'react-matrix-tree';
import 'react-matrix-tree/dist/react-matrix-tree.css';

function App() {
  const data = [{ title: 'Title', data: [{ title: 'Title' }, { title: 'Title' }, { title: 'Title' }] }]

  return (
    <div>
      <Tree color='red' data={data} isMobile={false} />
    </div>
  )
}

Four Matrix

import React from 'react'

import { Tree } from 'react-matrix-tree';
import 'react-matrix-tree/dist/react-matrix-tree.css';

function App() {
  const data = [
    { title: 'Title', data: [{ title: 'Title' }, { title: 'Title' }, { title: 'Title' }, { title: 'Title' }] },
  ]

  return (
    <div>
      <Tree color='red' data={data} isMobile={false} />
    </div>
  )
}

The properties

Properties used to customise the rendering:

NameTypeDescription
colorStringArrow color of parent to child
dataArrayused to renders a tree view
isMobileBooleanUsed you to manage responsiveness

data Properties

NameTypeDescription
titleStringTree title
imageSourceStringoptional display's a image
tooltipStringoptional Displays a given content when user hovers on title
onClickfuncoptional Calls the given function when user clicks on title and pass two parameters, first one is click event and second is the object of tree prop
dataArrayoptional Child's array

Demo

A demo is worth a thousand words

Contribute

Show your ❤️ and support by giving a ⭐. Any suggestions are welcome! venkatmcajj@gmail.com

License

Licensed under MIT

1.1.3

12 months ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago