Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton committed Mar 29, 2016
1 parent 470638e commit fa46737
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,30 @@ A browser-ready tree library that can efficiently display a large tree with smoo
```bash
npm install --save infinite-tree
```

## Usage
```js
import InfiniteTree from 'infinite-tree';
import 'infinite-tree/dist/infinite-tree.css';

const data = {
id: 'fruit',
label: 'Fruit',
children: [
{ id: 'apple', label: 'Apple' },
{ id: 'banana', label: 'Banana', children: [{ id: 'cherry', label: 'Cherry' }] }
]
};
const tree = new InfiniteTree({
el: document.querySelector('#tree'),
data: [data],
autoOpen: true
});

tree.on('tree.open', (node) => {
});
tree.on('tree.close', (node) => {
});
tree.on('tree.select', (node) => {
});
```

0 comments on commit fa46737

Please sign in to comment.