1.2 KiB
1.2 KiB
List
_This is the list class. It provides a scrollable list of selectable items with support for _ custom item rendering, separators, and selection handling.
Extends: Collection
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| offset | number | 0 | Current scroll offset for viewing long lists |
Events
| Event | Parameters | Description |
|---|---|---|
| onSelect | index number, item table |
Fired when an item is selected |
Functions
| Method | Returns | Description |
|---|---|---|
| List:onSelect | List | Registers a callback for the select event |
| List:scrollToBottom | List | Scrolls the list to the bottom |
| List:scrollToTop | List | Scrolls the list to the top |
List:onSelect(callback)
Registers a callback for the select event
Parameters
callbackfunctionThe callback function to register
Returns
ListselfThe List instance
Usage
list:onSelect(function(index, item) print("Selected item:", index, item) end)
List:scrollToBottom()
Scrolls the list to the bottom
Returns
ListselfThe List instance
List:scrollToTop()
Scrolls the list to the top
Returns
ListselfThe List instance