Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/kikkupico/retree
- Owner: kikkupico
- Created: 2017-06-13T10:13:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-22T09:49:54.000Z (over 7 years ago)
- Last Synced: 2024-08-12T21:09:21.545Z (4 months ago)
- Topics: component, react, reactjs, tree, tree-view, ui
- Language: JavaScript
- Size: 94.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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) =>- {i.label}
)
}
);
}
}export default App;
```
## Development
Build: `npm install && npm run build`
Demo: `npm install && npm start`
## License
ISC.