Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kikkupico/retree

A minimal, extensible and customizable tree view UI component for react.
https://github.com/kikkupico/retree

component react reactjs tree tree-view ui

Last synced: 4 months ago
JSON representation

A minimal, extensible and customizable tree view UI component for react.

Awesome Lists containing this project

README

        

# retree [![npm version](https://badge.fury.io/js/retree.svg)](https://www.npmjs.com/package/react-treeview)

A minimal, extensible and customizable tree view UI component for react.

![enter image description here](https://github.com/vramakin/retree/raw/master/sample-minimal.png)

[Demo](https://vramakin.github.io/retree)

## Installation

```sh
npm install --save retree
```

## Usage

```javascript
import React, { Component } from 'react';
import ReTree from 'retree';
import {prepareData, getChecked} from 'retree';
import '../node_modules/retree/tree-view.css';

class App extends Component {
state = {
data: prepareData(
{
label:'Pets', id:0,
children:[
{ label:'Cats', id:4,
children:[
{label:'Bubbles', id:5},
{label:'Riddles', id:6}
]
},
{ label:'Dogs', id:1,
children:[
{label:'Scooby', id:2},
{label:'Snowy', id:3}
]
},
]
}
)
}

onChangeTree = (newData) => this.setState({data:newData});

render() {
return (



Checked Items are...

    { Array.from(getChecked(this.state.data, new Set()))
    .map((i,k) =>
  1. {i.label}
  2. )
    }


);
}
}

export default App;

```

## Development

Build: `npm install && npm run build`

Demo: `npm install && npm start`

## License

ISC.