Tree component for react
Demo (Also check out the src/example/
folder for usage).
npm install react-treeview-component
Include js file at "react-treeview-component/build/react-tree.js"
Include css file at "react-treeview-component/build/react-tree.css"
Added to your react component
<Treeview dataSource={this.props.dataSource}
onTreenodeClick={this.handleTreenodeClick}>
</Treeview>
{
"id": "string" // Unique identifier for the node
"text": "string" // Treenode display text
"icon": "string" // Custom icon, CSS class
"opened": Bool, // If the node is opened
"selected": Bool, // If the node is selected
"children": [] // Array of children nodes
}
######function (id, event)
- id: node id
- event: mouse clicked event
perform function on treenode clicked
######function (callback)
- callback: 1 parameter: node
perform depth first search on dataSource, applying callback on each node
######function (callback)
- callback: 1 parameter: node
perform breadth first search on dataSource, applying callback on each node
MIT.