Skip to content

GhostTreeItem reference ​

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

Keyed role="treeitem" node (default <li>) and roving focus target. Sets aria-selected, aria-disabled, and for branches (a GhostTreeGroup inside) aria-expanded and aria-controls; links aria-labelledby to its first labelling GhostTreeTrigger so the name excludes child items. Row clicks select and, with expandOnClick, toggle; clicks bubbling from nested items are ignored.

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

All component references

Props ​

NameTypeDefaultRequiredDescription
asGhostTreeItemElement"li"NoTag name or component rendered for the `role="treeitem"` node.
disabledbooleanfalseNoDisables selection, expansion, and roving focus for this node only.
textValuestring—NoExplicit typeahead label; defaults to the trigger or own text.
valuestring—YesUnique, stable key used in `modelValue`, `expanded`, and focus tracking.

Emits ​

None declared.

Models ​

None declared.

Slots ​

NameDescription
defaultItem content: usually one GhostTreeTrigger and, for branches, one GhostTreeGroup.

Slot props: default ​

NameTypeDescription
disabledbooleanSlot prop `disabled`.
expandablebooleanSlot prop `expandable`.
expandedbooleanSlot prop `expanded`.
focusedbooleanSlot prop `focused`.
levelnumberSlot prop `level`.
select() => voidSlot prop `select`.
selectedbooleanSlot prop `selected`.
toggle() => voidSlot prop `toggle`.

Exposed members ​

NameTypeDescription
blur() => voidExposed method `blur`.
elementHTMLElement | nullExposed property `element`.
focus(options?: FocusOptions) => voidExposed method `focus`.

Parts and data attributes ​

AttributeValueDescription
data-partitemrole="treeitem" node rendered by GhostTreeItem.
data-statecheckeddata-state on a selected item.
data-statedisableddata-state on a disabled, unselected item.
data-ghost-tree-valuepresentGhostTreeItem element; carries the item value string (free-form, so no fixed values are listed).
data-selectedpresentPresent on GhostTreeItem and its GhostTreeTrigger while the item is selected.
data-expandedtrue, falseOn branch GhostTreeItem elements only; mirrors aria-expanded.
data-disabledpresentPresent on the root, items, and triggers that are disabled (root or own flag).
data-level1, 2, 31-based depth on each GhostTreeItem (any positive integer; first levels listed).

CSS variables ​

NameDescription
--ghost-tree-level1-based depth set inline on each GhostTreeItem; themes use it for logical indentation. Consumers may override it.

Accessibility ​

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

Required ARIA attributes: aria-selected.

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 ​

None declared.