Skip to content

Commit df5aa6f

Browse files
committed
update README.md to explain how to use the new version
1 parent 50104a8 commit df5aa6f

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
### How to use bs5-nav-tree v0.2.1
2+
#### Initializing the tree
3+
1. Make sure you have a list object with id "nav-tree" like ``<ul id="nav-tree"></ul>`` and, all list items must have its own id like ``<li id="li1"></li>``. If you have speacial list item or link add 'extra' class to exulude it.
4+
5+
For example:
6+
```html
7+
<ul id="nav-tree">
8+
<li id="li8">
9+
<a>
10+
Collapse 3
11+
</a>
12+
<ul>
13+
<li id="li9">
14+
<a href="#">
15+
Link 4
16+
</a>
17+
</li>
18+
<li id="li10">
19+
<a href="#">
20+
Link 5
21+
</a>
22+
</li>
23+
</ul>
24+
</li>
25+
</ul>
26+
```
27+
2. Add this to your js file:
28+
```js
29+
const nav = new NavTree(
30+
{
31+
selector: "#nav-tree",
32+
searchable: false, // default
33+
showEmptyGroups: false, // default
34+
35+
groupOpenIconClass: "fas", // default
36+
groupOpenIcon: "fa-chevron-down", // default
37+
38+
groupCloseIconClass: "fas", // default
39+
groupCloseIcon: "fa-chevron-right", // default
40+
41+
linkIconClass: "fas", // default
42+
linkIcon: "fa-link", // default
43+
44+
iconWidth: "", // default
45+
46+
searchPlaceholderText: "Search", // default
47+
}
48+
);
49+
```
50+
51+
#### Updating the tree
52+
```js
53+
nav.update(menu_html);
54+
```
55+
56+
157
### How to use bs5-nav-tree v0.2
258
#### Initializing the tree
359
1. Make sure you have a list object with id "nav-tree" like ``<ul id="nav-tree"></ul>`` and, all list items must have its own id like ``<li id="li1"></li>``. If you want to search on tree add "data-searchable" attribute to the list, and if you want to show empty groups after search add "data-show-empty-groups" attribute to the list.

0 commit comments

Comments
 (0)