Skip to content

takipi/react-ui-tree

 
 

Repository files navigation

react-ui-tree

Build Status npm npm

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

npm install react-ui-tree --save

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
/>

// 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"
    }]
  }]
}

// The Takipi changes made to this repo are support for: // disableHorizontalDrag - if set to true, all elements can only be dragged vertically // disableRootDrag - if set to true, the root of a tree is un-draggable

check app.js for a working example

Development

License

MIT

Packages

No packages published

Languages

  • JavaScript 79.9%
  • CSS 11.9%
  • HTML 6.5%
  • Makefile 1.7%