##React Treeview
npm install --save react-treeviewer
The fontawesome css file is not included so include it in your webpage:
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" />
##Another tree viewer? There are already multiple solutions out the for viewing hierarchical data but I found all existing libraries to be lacking in some manner. I wanted to be able to customize more than I could with the existing solutions.
##Features
- Customize expand and collapse icons
- Add custom icons to each node
- Expand nodes by clicking text if selectable is not true.
- Draggable nodes.
- Double Click a node to expand or collapse all the children
- Test suite with 100% coverage
##Coming soon
- Lazy loading node's children
- Live Examples
import TreeView from 'react-treeviewer';
render: () {
<TreeView
data={data}
/>
}
Turn animations on/off when expanding or collapsing a node.
--
Can nodes be selected? ( Selected nodes get the className: ad-selected-node )
--
Callback executed when a node is selected
--
Can nodes be dragged?
--
Callback functions associated with dragging a node.
--
Callback function executed when a node is expanded.
--
Callback function executed when a node is collapsed.
Callback function executed when all nodes are expanded or collapsed.
--
Adds checkboxes to each node.
--
Callback executed when a node is checked
--
Fontawesome icon string to represent the collapsed node anchor
--
Fontawesome icon string to represent the expanded node anchor
--
[{
id:1,
text:"Root",
icon:"folder",
expanded:false,
children:[{
id:3,
selected: true,
checked: false,
text:"Child 1",
iconObj: {
name: 'rocket',
size: '2x',
spin: true,
style: { color: 'red' }
},
children:[{id:5, text:"Grandchild 1"}]
}
]
}]
Add properties to each data node for more fine grained control.
Fontawesome icon name.
--
All properties in this object will be passed down to the icon. (This overrides the icon string property if present.)
Is the node expanded?
--
Is the node selected?
--
Is the node checked?
If you have ideas for more “How To” recipes that should be on this page, or any additional features you would like let me know or contribute some! "# react-treeview-ad"