reactjs-treeview

1.0.2 • Public • Published

A React tree view library

NPM JavaScript Style Guide

Install

npm install --save reactjs-treeview

Example

https://ttlong3103.github.io/react-simple-tree-view/

API

Name Type Default Description
initialData Array [] Array of nodes to initalize tree. Each node has form:
{
  icon: Component
  title: String | Component
  childrenNode: Array
  isExpanded: Boolean
  isSelected: Boolean
  ...yourExtraData
}
indentChild Number 30 Indentation of children node compares to its folder parent
selectionBackColor String
#257AFD
Background color of selected node
onClickNode Function Callback when click a tree node
(e, { path, node }, newTree) => any
- e (Object) : Event data
- path (Array) : Path to node
- node (Object) : Data of node
- newTree (Object) : Updated tree
onExpandNode Function Callback when expand a parent node by clicking expand indicator
({ path, node }, newTree) => any
- path (Array) : Path to node
- node (Object) : Data of node
- newTree (Object) : Updated tree
onCollapseNode Function Callback when collapse a parent node by clicking collapse indicator
({ path, node }, newTree) => any
- path (Array) : Path to node
- node (Object) : Data of node
- newTree (Object) : Updated tree

License

MIT © ttlong3103

Development

  1. At root of repo, run npm start. This command builds code and watchs for code changes.
  2. Open another command-line, cd to folder example of this repo and run npm start. This will start browser with above built code.

Package Sidebar

Install

npm i reactjs-treeview

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

95.7 kB

Total Files

6

Last publish

Collaborators

  • ttlong