OGE logoOGE

Tree View

<oge-tree-view> renders a hierarchy from either a flat parent-referencing array or nested children. It follows the WAI-ARIA APG treeview pattern — a roving tabindex over role="treeitem" rows, arrow / Home / End / type-ahead navigation and * to open a level — and expresses depth with aria-level / aria-posinset / aria-setsize over a flat DOM, which is what lets it virtualize.

APG pattern signals virtual scroll lazy load

Flat data

The canonical shape: rows carrying a parent reference. expandedKeys and selectedKeys are two-way models keyed by identity, so they survive reordering. The disabled node is skipped by both clicks and arrow keys.

keyExpr parentIdExpr [(expandedKeys)] selectionMode
Documents
Contracts

expandedKeys: 1 · selectedKeys: (none)

Nested data

Point itemsExpr at the children field and the parent links are derived for you — core's flattenNestedTree normalizes the payload into the same single pipeline the flat shape uses.

itemsExpr
src
app
app.ts
app.routes.ts
main.ts
package.json

Checkboxes & cascade

Checking a node cascades down to its descendants and normalizes up: a parent is checked only when every child is, and indeterminate whenever some are. The checkbox is an aria-hidden glyph and the state lives on the row as aria-checked — a real checkbox inside role="treeitem" would be a nested-interactive violation.

showCheckBoxes tri-state selectedKeysMode
Documents
Reports
Q1.pdf
Q2.pdf
Contracts
Photos
Holiday
Archive

selectedKeys: (none)

Matching is accent- and locale-insensitive (core's foldText), the ancestors of a hit are auto-expanded so it is reachable, and the matched substring is wrapped in <mark>. filterMode: 'fullBranch' also keeps a match's descendants.

searchEnabled filterMode highlight

Lazy load on demand

Only the roots are bound; hasItemsExpr tells the tree which of them can expand. The first expand calls loadChildren and the engine renders a placeholder row until it resolves. Fetched children are folded into the index, so cascading selection reaches them.

loadChildren hasItemsExpr skeleton row
readme.txt

Virtual scrolling

Because the tree renders a flat list with aria-level rather than nested groups, it can window the DOM. Built on core's OffsetTree + computeWindow; keyboard focus moves scroll the target into view first, since the row may not exist yet.

virtualScroll 10 000 nodes
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10
Item 11
Item 12
Item 13
Item 14
Item 15
Item 16
Item 17
Item 18
Item 19

Drag & drop reparenting

Drag a node onto the middle of another to make it a child, or onto an edge to place it as a sibling. Hovering a collapsed parent opens it, Escape cancels, and a node can never be dropped into its own subtree. The tree emits itemReordered and leaves the data change to you.

allowDragging inside / before / after cycle guard
Documents
Reports
Q1.pdf
Q2.pdf
Contracts
Photos
Holiday
Archive

Custom node template

The item template replaces the built-in label. It renders inside the role="treeitem" row, so it must stay free of focusable controls.

ogeTreeItemTemplate
Documentslevel 0
Contractslevel 1