All Projects → seviltagiyeva → react-vertical-tree

seviltagiyeva / react-vertical-tree

Licence: other
Simple & lightweight vertical tree like view.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to react-vertical-tree

Fast
Find in AST - Search and refactor code directly in Abstract Syntax Tree as you do with grep for strings
Stars: ✭ 194 (+743.48%)
Mutual labels:  tree
Vuejs Tree
A highly customizable and blazing fast Vue tree component ⚡🌲
Stars: ✭ 211 (+817.39%)
Mutual labels:  tree
Merkletree
A Merkle Tree implementation written in Go.
Stars: ✭ 236 (+926.09%)
Mutual labels:  tree
Outwiker
Сross-platform software for keeping your notes in a tree
Stars: ✭ 198 (+760.87%)
Mutual labels:  tree
Lark
Lark is a parsing toolkit for Python, built with a focus on ergonomics, performance and modularity.
Stars: ✭ 2,916 (+12578.26%)
Mutual labels:  tree
Scikit Garden
A garden for scikit-learn compatible trees
Stars: ✭ 230 (+900%)
Mutual labels:  tree
Interview Questions
List of all the Interview questions practiced from online resources and books
Stars: ✭ 187 (+713.04%)
Mutual labels:  tree
RedisTree
Redis Tree (Ploytree) Structure Module
Stars: ✭ 64 (+178.26%)
Mutual labels:  tree
Git Master
Git Master Extension for git file tree, support GitHub、GitLab 、 Gitee、Gitea
Stars: ✭ 205 (+791.3%)
Mutual labels:  tree
Computer Science In Javascript
Computer science reimplemented in JavaScript
Stars: ✭ 2,590 (+11160.87%)
Mutual labels:  tree
Domhandler
Handler for htmlparser2, to get a DOM
Stars: ✭ 203 (+782.61%)
Mutual labels:  tree
Heyui
🎉UI Toolkit for Web, Vue2.0 http://www.heyui.top
Stars: ✭ 2,373 (+10217.39%)
Mutual labels:  tree
Dsladapter
🔥 Kotlin时代的Adapter, Dsl 的形式使用 RecyclerView.Adapter, 支持折叠展开, 树结构,悬停,情感图状态切换, 加载更多, 多类型Item,侧滑菜单等
Stars: ✭ 231 (+904.35%)
Mutual labels:  tree
Rrt Algorithms
n-dimensional RRT, RRT* (RRT-Star)
Stars: ✭ 195 (+747.83%)
Mutual labels:  tree
mst-persist
Persist and hydrate MobX-state-tree stores (in < 100 LoC)
Stars: ✭ 75 (+226.09%)
Mutual labels:  tree
React Vtree
React component for efficiently rendering large tree structures
Stars: ✭ 185 (+704.35%)
Mutual labels:  tree
Element Tree Grid
tree grid extends element ui with vue
Stars: ✭ 223 (+869.57%)
Mutual labels:  tree
data-structure-project
自己实现集合框架系列整理总结
Stars: ✭ 29 (+26.09%)
Mutual labels:  tree
codacy-scalameta
Codacy tool for Scalameta
Stars: ✭ 35 (+52.17%)
Mutual labels:  tree
Libdict
C library of key-value data structures.
Stars: ✭ 234 (+917.39%)
Mutual labels:  tree

React Vertical Graph Tree

Build Status Download Count

Simple and lightweight tree component for react apps.

Installation

npm i react-vertical-tree

Usage

Use showed below structure to set data to <Tree/> component:

import Tree from 'react-vertical-tree'

...
// data have to be below structure

const  data = [
  {id: 1, name: 'company', parent: null, children: [
    {id: 2, parent: {id: 1}, name: 'subcompany1', children: []},
    {id: 3, parent: {id: 1}, name: 'subcompany2', children: [
      {id: 4, parent: {id: 3}, name: 'example-company', children: []}
    ]},
    {id: 5, parent: {id: 1}, name: 'company2', children: []},
    {id: 6, parent: {id: 1}, name: 'company3', children: []}
  ]}
]

...
return <Tree data={data} />

...

default preview

Add direction property for line arrows:

import Tree from 'react-vertical-tree'
...
return <Tree
        data={data} 
        direction
      />
...

default preview with direction

Also you can use withStyles function and change the default style. Available class names are node, lines, text .

import Tree, { withStyles } from 'react-vertical-tree'

...
 const styles = {
        lines: {
          color: '#1890ff',
          height: '90px',
        },
        node: {
          backgroundColor: '#fff',
          border: '1px solid #1890ff',
        },
        text: {
          color: '#ccc',
        }
      }
...

const StyledTree = withStyles(styles)(Tree)
return <StyledTree data={data} direction/>

...

customized style

Also you can fully customize node component with render method:

import Tree from 'react-vertical-tree'

...

return <Tree 
        data={data} 
        direction
        render={ item => <div>{`${item.id}.${item.name}`}</div>}
      />

...

customized nodes

Handle node actions with onClick method:

import Tree, { withStyles } from 'react-vertical-tree'

...

return <Tree 
        data={data} 
        direction
        onClick={ item => console.log(item.id)}
      />

...

Configuration

Properties Type Default Description
data array [] tree content
direction bool false directional arrow in lines
render function null customize node content
onClick function null event handler for node components
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].