react-file-view
Version:
React file-view component
59 lines (43 loc) • 1.42 kB
Markdown
[](https://travis-ci.org/pqx/react-ui-tree)
[](https://www.npmjs.com/package/react-ui-tree)
[](https://www.npmjs.com/package/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
[](https://github.com/wangzuo/js-tree).
[](https://pqx.github.io/react-ui-tree)
```sh
npm install react-ui-tree --save
```
```javascript
<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
/>
// 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](https://github.com/pqx/react-ui-tree/blob/master/example/app.js)
for a working example
* npm install
* npm start
* http://localhost:8080/example
MIT