ListBox2D
- Last UpdatedNov 24, 2025
- 4 minute read
The ListBox2D node enables you to create a list box with single item selection. It supports item list vertical scroll.

Platform support
This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Managing user interaction
When active is set to true this component accepts inputs from gamepad, keyboard, and mouse.
|
Action |
Gamepad |
Mouse |
Keyboard |
|---|---|---|---|
|
Direct selection |
Left click |
||
|
Select next item |
D-Cross down |
Arrow down |
|
|
Select previous item |
D-Cross up |
Arrow down |
|
|
Select last visible item |
(RB) (6) |
Page down |
|
|
Select first visible item |
(LB) (5) |
Page Up |
Alternatively, you can configure selection to be driven by script using the selectedIndex setting.
Selection and selected items
-
The selectedIndex and selectedValue parameters refers to the item in the list that is under the selector.
-
The selectedValue property is read only.
-
The selectedIndex property can be configured to select an item by code, or to get the selection performed by user.
-
The selectedItems parameter marks one or more items as selected. Selected items are presented with a different text color. Modifying the list has no effect on the selector position.
-
Typically, the interface may have a Button2D that is used to mark the item under the selector as Selected or Unselected.
Sort mode
-
By setting sortMode to auto value the items are sorted at runtime.
-
The items are divided in two groups: -selected item, -not selected items.
-
The selected items group is shown before the not selected group.
-
The elements in both groups are sorted by name ascending.
List and Combobox modes
By default, the mode field is set to list.
When changing the mode field to combobox, the behavior of the list box changes. As the selector moves, the selectedIndex and selectedValue fields immediately show the item currently under the selector.
This behaviour was introduced to use ListBox2D as comboboxes, that you can manage together with Text2D.
-
When you click the Text2D, the ListBox2D displays.
-
When you click an item in the ListBox2D, the Text2D updates and the ListBox2D is not visible.
Due to the introduction of the DropdownList2D, this functionality has become obsolete.
Code example
This is a code example for ListBox2D.
<ListBox2D name="list" position="100 100" size="200 100" visible="true" items="item0,item1,item2" font="Arial,antialias,20" textColor="1 0 0" active="true"/>
ListBox2D fields
These are the fields for ItemViewer2D node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > RectBase2D > ListBox2D
|
Field |
Type |
Use |
Default |
Description |
|---|---|---|---|---|
|
active |
sbool |
Optional |
false |
Activates keyboard mouse and gamepad listbox input. |
|
arrowClickEnable |
sbool |
Optional |
false |
This option enables scrolling on touchscreen devices. When enabled, the arrows for hidden items become clickable — allowing navigation to those items. |
|
clicked |
sevent |
Optional |
Fired when the listbox is clicked. |
|
|
dynamicFontScaling |
sbool |
Optional |
true |
Improves the quality of text by applying Dynamic Font Scaling rendering. |
|
font |
sstring |
Optional |
Arial,Regular,20 |
The font to use for list items. |
|
items |
mstring |
Optional |
A comma (',') separated list of items. |
|
|
mode |
senum |
Optional |
List |
Enables you to select between list mode and combobox mode. The default mode is list. |
|
selectorColor |
svec3 |
Optional |
0 0 1 |
Selector band color. |
|
selectedIndex |
sint |
Optional |
0 |
Internally set when user interacts with component. Can be used to highlight an item by script code. |
|
selectedItems |
mstring |
Optional |
List of items to show as selected. |
|
|
selectedTextColor |
svec3 |
Optional |
0 1 0 |
The color used for selected items. |
|
selectedValue |
sstring |
Read only |
Internally calculated |
The selected item text. |
|
sortMode |
senum |
Optional |
none |
Specifies between none and auto options. |
|
textColor |
svec3 |
Optional |
1 1 1 |
The text color for list items. |