NUI / Components / Scroll, Lists & Data

TreeView

ImplementedScroll, Lists & Data

TreeView displays hierarchical data with expandable entries.

Supported as a hierarchical data view.

Overview

TreeView displays hierarchical data with expandable entries.

When to use

  • Skill trees.
  • File-like hierarchies.
  • Nested categories.
  • Quest chains.
  • Nested settings.

Children

Uses data/template fields instead of normal children.

Basic syntax

nui
TreeView QuestTree {
    items: "main|Main Quest|0;side|Side Quest|0"
}

Supported properties

PropertyTypeRequiredDefaultDescription
itemsstringNoEmptyInline item data.
dataSourcestringNoEmptyNamed external data source.
childrenSourcestringNoEmptyChild data source field or binding.
expandedKeysstringNoEmptyInitially expanded keys.
maxDepthintegerNoUnsetMaximum rendered tree depth.
itemKeystringNoEmptyField or static key binding.
itemTextstringNoEmptyField or static display text binding.
itemValuestringNoEmptyField or static value binding.
itemCommandstringNoEmptyCommand when an item is used or selected.
selectedKeystringNoEmptyInitially selected item key.
selectionModeenumNosingleSelection mode.
entryHeightnumberNoDefaultEntry height.
scrollBarVisibilityenumNoautoScrollbar visibility.
gapnumberNo0Space between entries.
widthnumberNoAutoDesired width.
heightnumberNoAutoDesired height.
visibleboolNotrueVisibility flag.

Contextual properties

Contextual property rules

TreeView may receive stack, canvas, grid, wrap, or ExpandableArea slot properties only when it is authored as a direct child of the matching parent. It does not support normal authored child nodes.

Full syntax example

nui
TreeView QuestTree {
    items: "main|Main Quest|0;side|Side Quest|0"
    childrenSource: "children"
    expandedKeys: "main,side"
    maxDepth: 4
    itemKey: "id"
    itemText: "name"
    itemValue: "state"
    itemCommand: "SelectQuest"
    selectedKey: "main"
    selectionMode: single
    entryHeight: 32
    scrollBarVisibility: auto
    gap: 4
    width: 360
    height: 280
    visible: true
}

Limitations

  • Normal children { ... } blocks are not public syntax for this component.
  • Tree data shape and binding examples should be verified against the project data source used in a project.