File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,30 @@ A browser-ready tree library that can efficiently display a large tree with smoo
1212``` bash
1313npm install --save infinite-tree
1414```
15+
16+ ## Usage
17+ ``` js
18+ import InfiniteTree from ' infinite-tree' ;
19+ import ' infinite-tree/dist/infinite-tree.css' ;
20+
21+ const data = {
22+ id: ' fruit' ,
23+ label: ' Fruit' ,
24+ children: [
25+ { id: ' apple' , label: ' Apple' },
26+ { id: ' banana' , label: ' Banana' , children: [{ id: ' cherry' , label: ' Cherry' }] }
27+ ]
28+ };
29+ const tree = new InfiniteTree ({
30+ el: document .querySelector (' #tree' ),
31+ data: [data],
32+ autoOpen: true
33+ });
34+
35+ tree .on (' tree.open' , (node ) => {
36+ });
37+ tree .on (' tree.close' , (node ) => {
38+ });
39+ tree .on (' tree.select' , (node ) => {
40+ });
41+ ```
You can’t perform that action at this time.
0 commit comments