A React tree view library
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
- At root of repo, run
npm start
. This command builds code and watchs for code changes. - Open another command-line,
cd
to folderexample
of this repo and runnpm start
. This will start browser with above built code.