NUI / Components / Scroll, Lists & Data

ListView

ImplementedScroll, Lists & Data

ListView displays repeated data entries in a vertical list.

Supported as a data-driven list.

Overview

ListView displays repeated data entries in a vertical list.

When to use

  • Inventories.
  • Settings lists.
  • Player lists.
  • Quest lists.
  • Other repeated data.

Children

Uses data/template fields instead of normal children.

Basic syntax

nui
ListView InventoryList {
    items: "wood|Wood|1;stone|Stone|2"
}

Supported properties

PropertyTypeRequiredDefaultDescription
itemsstringNoEmptyInline item data.
dataSourcestringNoEmptyNamed external data source.
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.
virtualizedboolNotrueEnables virtualization.
recycleEntriesboolNotrueReuses entry widgets.
overscannumberNoDefaultExtra entries around viewport.
scrollBarVisibilityenumNoautoScrollbar visibility.
gapnumberNo0Space between entries.
widthnumberNoAutoDesired width.
heightnumberNoAutoDesired height.
visibleboolNotrueVisibility flag.

Contextual properties

Contextual property rules

ListView 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
ListView InventoryList {
    items: "wood|Wood|1;stone|Stone|2"
    itemKey: "id"
    itemText: "name"
    itemValue: "count"
    itemCommand: "SelectItem"
    selectedKey: "stone"
    selectionMode: single
    entryHeight: 36
    virtualized: true
    recycleEntries: true
    overscan: 2
    scrollBarVisibility: auto
    gap: 4
    width: 320
    height: 240
    visible: true
}

Limitations

  • Normal children { ... } blocks are not public syntax for this component.
  • Drag and drop should not be documented as currently supported.