# react-ui-sortable-tree

> React tree component

Latest version **2.6.15** (published 2018-01-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-ui-sortable-tree
pnpm add react-ui-sortable-tree
yarn add react-ui-sortable-tree
bun add react-ui-sortable-tree
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.6.15 |
| Published | 2018-01-11 |
| First published | 2017-07-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Wang Zuo |
| Maintainers | ukrbublik |
| Keywords | react, react-component, tree |

## Links

- npm: https://www.npmjs.com/package/react-ui-sortable-tree
- Repository: https://github.com/ukrbublik/react-ui-sortable-tree
- Issues: https://github.com/ukrbublik/react-ui-sortable-tree/issues
- npm.io page: https://npm.io/package/react-ui-sortable-tree

## Dependencies (4)

- [js-tree](https://npm.io/package/js-tree.md) ^1.1.0
- [classnames](https://npm.io/package/classnames.md) ^2.2.5
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.0
- [create-react-class](https://npm.io/package/create-react-class.md) ^15.6.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.6.15 (latest) — 2018-01-11
- 2.6.14 — 2017-09-05
- 2.6.13 — 2017-09-05
- 2.6.12 — 2017-09-05
- 2.6.11 — 2017-09-05
- 2.6.10 — 2017-08-07
- 2.6.9 — 2017-08-06
- 2.6.8 — 2017-08-01
- 2.6.7 — 2017-07-30
- 2.6.5 — 2017-07-09
- 2.6.4 — 2017-07-09
- 2.6.3 — 2017-07-09
- 2.6.1 — 2017-07-09

## README

# react-ui-sortable-tree [![Build Status](https://travis-ci.org/ukrbublik/react-ui-sortable-tree.svg)](https://travis-ci.org/ukrbublik/react-ui-sortable-tree)
React tree component

Forked from [https://github.com/pqx/react-ui-tree](https://github.com/pqx/react-ui-tree). 
Fully reworked sorting (drag-n-drop) of tree to allow control of drop (see prop `canMoveNode`).
Important! Add class 'm-tree-container' to html-element that holds tree AND is scrollable.

This project was initially developed for a webpage builder. It maintains an internal tree structure within the component through [js-tree](https://github.com/wangzuo/js-tree).
### Demo
[https://ukrbublik.github.io/react-ui-sortable-tree/](https://ukrbublik.github.io/react-ui-sortable-tree/)
### Installation
``` sh
npm install react-ui-sortable-tree --save
```
### Usage
``` 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
  canMoveNode={this.canMoveNode} // canMoveNode(from, to, placement, parent) return bool
/>

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

### Development
- npm install
- npm start
- http://localhost:8888/example

### License
MIT

---
_Source: https://npm.io/package/react-ui-sortable-tree · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
