Data display / Tree view

Data display

Tree view

A hierarchy of links: the ancestor path down to the current node, then its children in branches that open and load the first time they open.

import { EcoTreeView } from "vue-ecosphere"

Ancestor path, current node and loaded branches

Open York (it loads) or Hull (it fails once; Retry). “Show 2 more” appends a page, including a branch that comes back empty.

Hierarchy

Depth limit and a repeated unit

A node that repeats among its own ancestors never gets a toggle, so a cycle cannot loop requests.

  • 1120 · Branch · 2 children

    • 1123 · Depot · 6 children

      Open this unit to explore deeper levels.

    • 1120 · Branch · 2 children

      This unit repeats in the hierarchy, so it is not expanded again.

Narrow container

tree--tight for a drawer or side panel on a wide screen.

Selection widget

Tab into the tree, then use the arrow keys: Right opens or moves in, Left closes or moves to the parent, Enter or Space selects.

Move 12 vehicles to

  • Leeds branch

    3 depots

    • Leeds Central depot
    • Kirkstall depot
    • Morley depot

Selected: Kirkstall depot

API

NameTypeDefaultDescription
nodesEcoTreeNode[]—{ id, label, href?, meta?, icon?, badges?, current?, path?, note?, children?, hasChildren?, state?, stateText?, more?, selectable? }.
v-model:expandedstring[][]Open branches. Keep it in the URL; open the current node by default.
label / labelledbystring—Whose hierarchy this is (“Hierarchy of North region”).
tightbooleanfalseNarrow-container spacing (tree--tight) for drawers and side panels.
maxDepthnumber8Past this depth, nodes with children show a note instead of a toggle.
selectablebooleanfalseSelection widget on the ARIA tree pattern: role="tree", roving tabindex, arrows, Home/End, type-ahead, Enter/Space.
v-model:selectedstring | string[] | nullnullSelected node id (an array with multiple).
multiple / selectParentsbooleanfalseSeveral selections; let nodes with children be selected too.
@toggle(node, open) => void—A branch opened or closed — load it the first time it opens.
@retry / @more / @select(node) => void—Retry a failed branch, append the next page, an item was selected.