Fork of https://github.com/pqx/react-ui-tree
React tree component
This project was initially developed for a webpage builder. It maintains an internal tree structure within the component through js-tree.
https://pqx.github.io/react-ui-tree
npm install react-ui-tree --save
<Tree
paddingLeft={20} // left padding for children nodes in pixels
tree={this.state.tree} // tree object
onChange={this.handleChange} // onChange(tree) tree object changed
onNodeDragged={this.onNodeDragged} // onNodeDragged(draggedNode, draggedNodeParent} tree objects (subtrees of main tree)
renderNode={this.renderNode} // renderNode(node) return react element
/>
// a sample tree object
// node.children, node.collapsed, node.leaf properties are hardcoded
{
"module": "react-ui-tree",
"children": [{
"collapsed": true,
"module": "dist",
"children": [{
"module": "node.js"
}]
}]
}
check app.js for a working example
- npm install
- npm start
- https://localhost:8080/example
MIT