Skip to content

Commit e8300da

Browse files
committed
refactor(aria/tree): Extend public api with expansion methods
1 parent cad9ce6 commit e8300da

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
@@ -205,6 +205,16 @@ export class Tree<V> {
205205
scrollActiveItemIntoView(options: ScrollIntoViewOptions = {block: 'nearest'}) {
206206
this._pattern.inputs.activeItem()?.element().scrollIntoView(options);
207207
}
208+
209+
/** Expands all tree items if multi-expandable. */
210+
expandAll() {
211+
this._pattern.expansionManager.openAll();
212+
}
213+
214+
/** Collapses all tree items. */
215+
collapseAll() {
216+
this._pattern.expansionManager.closeAll();
217+
}
208218
}
209219

210220
/**

0 commit comments

Comments
 (0)