Skip to content

GhostTree reference ​

Package: @ghostvue/vue. Status: experimental (stability policy).

Headless APG Tree View root (role="tree", default <ul>). Owns controlled/uncontrolled single or multiple selection (v-model) and expansion (v-model:expanded) through useControllableState, a single roving tab stop over visible enabled items in rendered DOM order, RTL-aware hierarchical arrow keys, Home/End, * sibling expansion, 500ms IME-safe typeahead, and focus recovery when an ancestor collapses or the focused item unmounts. Never mutates consumer data.

Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.

All component references

Props ​

NameTypeDefaultRequiredDescription
allowDeselectbooleanfalseNoIn single mode, re-activating the selected node clears the selection.
asGhostTreeElement"ul"NoTag name or component rendered for the `role="tree"` container.
defaultExpandedstring[]"[]"NoInitial expanded branch values when `expanded` is omitted.
defaultValueGhostTreeValue—NoInitial uncontrolled selection.
dirGhostTreeDirection—NoExplicit writing direction; otherwise inherited from `[dir]`.
disabledbooleanfalseNoDisables every interaction in the tree.
expandedstring[]—NoControlled expanded branch values (`v-model:expanded`).
expandOnClickbooleantrueNoPointer clicks on a branch row also toggle expansion.
loopbooleanfalseNo`ArrowDown` / `ArrowUp` wrap at the ends of the visible node list.
modelValueGhostTreeValue—NoControlled selection (`v-model`). Omit for uncontrolled mode.
selectionModeGhostTreeSelectionMode"single"NoSingle (`string | undefined`) or multiple (`string[]`) selection.

Emits ​

NamePayloadDescription
selectGhostTreeSelectPayloadEmitted as `select`.
toggleGhostTreeTogglePayloadEmitted as `toggle`.

Models ​

PropEventTypeDescription
expandedupdate:expandedstring[]v-model binding for `expanded`.
modelValueupdate:modelValueGhostTreeValuev-model binding for `modelValue`.

Slots ​

NameDescription
defaultGhostTreeItem nodes; receives selection, expansion, and focus state plus select/toggle helpers.

Slot props: default ​

NameTypeDescription
expandAllSiblings(value: string) => voidSlot prop `expandAllSiblings`.
expandedstring[]Slot prop `expanded`.
focusedValuestring | undefinedSlot prop `focusedValue`.
isExpanded(value: string) => booleanSlot prop `isExpanded`.
isSelected(value: string) => booleanSlot prop `isSelected`.
modelValueGhostTreeValueSlot prop `modelValue`.
select(value: string) => voidSlot prop `select`.
toggleExpanded(value: string) => voidSlot prop `toggleExpanded`.

Exposed members ​

NameTypeDescription
blur() => voidExposed method `blur`.
elementHTMLElement | nullExposed property `element`.
focus(options?: FocusOptions) => voidFocuses the current roving tab stop item, if any.

Parts and data attributes ​

AttributeValueDescription
data-partrootrole="tree" container rendered by GhostTree.
data-ghost-treepresentMarker present on the GhostTree root.
data-dirltr, rtlResolved writing direction on the GhostTree root.
data-disabledpresentPresent on the root when the whole tree is disabled.

CSS variables ​

None declared.

Accessibility ​

Role: tree. APG pattern: https://www.w3.org/WAI/ARIA/apg/patterns/treeview/.

Required ARIA attributes: aria-label.

Keyboard ​

KeyActionAutomated browser test
TabMoves focus into and out of the tree through its single roving tab stop.GhostTree @component:GhostTree › tree/basic: one Tab stop, every documented key, and Axe in both states (@ghostvue/vue)
ArrowDownMoves focus to the next visible enabled item without changing selection; wraps only when loop is true.GhostTree @component:GhostTree › tree/basic: one Tab stop, every documented key, and Axe in both states (@ghostvue/vue)
ArrowUpMoves focus to the previous visible enabled item without changing selection; wraps only when loop is true.GhostTree @component:GhostTree › tree/basic: one Tab stop, every documented key, and Axe in both states (@ghostvue/vue)
ArrowRightLTR: expands a closed branch, or moves to the first visible enabled child of an open branch. RTL: collapses an open branch, or moves to the closest visible enabled ancestor.GhostTree @component:GhostTree › tree/basic: one Tab stop, every documented key, and Axe in both states (@ghostvue/vue)
ArrowLeftLTR: collapses an open branch, or moves to the closest visible enabled ancestor. RTL: expands a closed branch, or moves to the first visible enabled child of an open branch.GhostTree @component:GhostTree › tree/basic: one Tab stop, every documented key, and Axe in both states (@ghostvue/vue)
HomeMoves focus to the first visible enabled item.GhostTree @component:GhostTree › tree/basic: one Tab stop, every documented key, and Axe in both states (@ghostvue/vue)
EndMoves focus to the last visible enabled item.GhostTree @component:GhostTree › tree/basic: one Tab stop, every documented key, and Axe in both states (@ghostvue/vue)
EnterSelects the focused item (single), deselects it when allowDeselect is true, or toggles it (multiple). Never toggles expansion.GhostTree @component:GhostTree › tree/basic: one Tab stop, every documented key, and Axe in both states (@ghostvue/vue)
Same as Enter when no typeahead query is active; otherwise appends a space to the query.GhostTree @component:GhostTree › tree/basic: one Tab stop, every documented key, and Axe in both states (@ghostvue/vue)
*Expands every closed enabled sibling branch of the focused item in one update.GhostTree @component:GhostTree › tree/basic: one Tab stop, every documented key, and Axe in both states (@ghostvue/vue)
a-zPrintable characters run a 500ms typeahead over visible enabled items, moving focus without selecting.GhostTree @component:GhostTree › tree/basic: one Tab stop, every documented key, and Axe in both states (@ghostvue/vue)

Verification ​

Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.

CategoryStatusEvidence
Automated keyboardPassedEvery declared key maps to a Chromium browser test that CI runs and requires to pass on every commit.
Manual interactionNot reviewedNo review recorded.
Assistive technologyNot reviewedNo review recorded.

Examples ​

tree/basic ​

Example source

Basic Headless

Single-selection file hierarchy with expand/collapse, one Tab stop, and arrow-key navigation.

  • src
    • main.ts
    • router.ts
  • package.json

Selected: src/main.ts

tree/multi-select ​

Example source

Multiple selection Headless

selectionMode="multiple" with controlled v-model and v-model:expanded; Space toggles the focused node.

  • Frontend
    • Vue
    • CSS
    • Accessibility
  • Design

Selected: css

Expanded: frontend

tree/split-trigger ​

Example source

Split trigger Headless

A toggle-only chevron and a select-only label with expandOnClick=false.

  • Team
    • Roadmap
    • Retro notes

tree/rtl ​

Example source

Right-to-left Headless

dir="rtl" hierarchy where ArrowLeft expands and enters branches and ArrowRight collapses or moves to the parent.

  • Invoices