Skip to content

Commit 8808be8

Browse files
committed
feat(useTreeNodesController): expand multiple items at once
1 parent 6d94a0d commit 8808be8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ With `useTree` you can focus on how to render your tree structure and forget abo
1414
- [interface TreeState](#interface-treestate)
1515
- [useTreeController()](#usetreecontroller)
1616
- [useTreeNodeController(id: string)](#usetreenodecontrollerid-string)
17+
- [useTreeNodesController(ids: string[])](#usetreenodescontrollerids-string)
1718
- [useTreeContent()](#usetreecontent)
1819
- [useTreeLoader()](#usetreeloader)
1920
- [Rendering a tree](#rendering-a-tree)
@@ -56,7 +57,7 @@ What `TreeContainer` will do for you is:
5657

5758
* `TreeContainer`: the easiest entry point for normal use. Wrap this around your component, pass a data source of interface `TreeSource`, and you're usually good to go.
5859
* `useTreeLoader()`: take a source and the current tree state and load data from the source to expand the tree, returning a simple an up-to-date data structure with tree data.
59-
* `useTreeController()` / `useTreeNodeController(id: string)`: return an object that allows you to control the state of the current tree (from context).
60+
* `useTreeController()` / `useTreeNodeController(id: string)` / `useTreeNodesController(ids: string[])`: return an object that allows you to control the state of the current tree (from context).
6061
* `useTreeContent()`: return the data for the current tree (from context).
6162

6263
We will now describe these in more detail.
@@ -113,6 +114,11 @@ Same as `useTreeController()`, but only for one tree node. You should, for insta
113114
* `toggleExpanded(): void`.
114115
* `setActive(active?: boolean): void`.
115116

117+
### useTreeNodesController(ids: string[])
118+
Same as `useTreeNodeController()`, but for multiple tree nodes. Not all methods make sense, so it only provides:
119+
120+
* `setMultipleExpanded(expanded?: boolean): void`.
121+
116122
### useTreeContent()
117123
When used inside the context of a tree, returns the current data of the tree. This can be used if you have several components nested inside your `<TreeContainer>` that all want to display the tree (or parts thereof).
118124

0 commit comments

Comments
 (0)