react-dnd-ui-tree
v4.6.2
Published
React tree component
Downloads
5
Maintainers
Readme
react-dnd-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.
Demo
https://pqx.github.io/react-ui-tree
Installation
yarn add react-dnd-ui-tree
Usage
<Tree
paddingLeft={20} // left padding for children nodes in pixels
tree={this.state.tree} // tree object
onChange={this.handleChange} // onChange(tree) tree object changed
renderNode={this.renderNode} // renderNode(node) return react element
draggable={false}
/>
// a sample tree object
// node.children, node.contracted, node.leaf properties are hardcoded
{
"module": "react-dnd-ui-tree",
"children": [{
"contracted": true,
"module": "dist",
"children": [{
"module": "node.js",
"leaf": true
}]
}]
}
Development
- npm install
- npm start
- http://localhost:8080/example
License
MIT