Skip to content

Commit 412cd57

Browse files
committed
refactor(aria/tree): Extend public api with expansion methods
1 parent 2b44107 commit 412cd57

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/aria/tree/tree.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,16 @@ export class Tree<V> {
210210
scrollActiveItemIntoView(options: ScrollIntoViewOptions = {block: 'nearest'}) {
211211
this._pattern.inputs.activeItem()?.element()?.scrollIntoView(options);
212212
}
213+
214+
/** Expands all tree items if multi-expandable. */
215+
expandAll() {
216+
this._pattern.expansionManager.openAll();
217+
}
218+
219+
/** Collapses all tree items. */
220+
collapseAll() {
221+
this._pattern.expansionManager.closeAll();
222+
}
213223
}
214224

215225
/**

0 commit comments

Comments
 (0)