diff --git a/docs/references/elements/Collection.md b/docs/references/elements/Collection.md index 725aae9..b320999 100644 --- a/docs/references/elements/Collection.md +++ b/docs/references/elements/Collection.md @@ -27,6 +27,9 @@ Extends: `VisualElement` |[Collection:clear](#collection-clear)|Collection|Clears all items from the Collection| |[Collection:getSelectedItems](#collection-getselecteditems)|table|Gets the currently selected items| |[Collection:getSelectedItem](#collection-getselecteditem)|selected|Gets first selected item| +|[Collection:getSelectedIndex](#collection-getselectedindex)|index|Gets the index of the first selected item| +|[Collection:selectNext](#collection-selectnext)|Collection|Selects the next item| +|[Collection:selectPrevious](#collection-selectprevious)|Collection|Selects the previous item| |[Collection:onSelect](#collection-onselect-callback)|Collection|Registers a callback for the select event| ## Collection:addItem(text) @@ -91,6 +94,32 @@ Gets first selected item ### Returns * `selected` `The` first item +## Collection:getSelectedIndex() + +Gets the index of the first selected item + +### Returns +* `index` `The` index of the first selected item, or nil if none selected + +### Usage +```lua +local index = Collection:getSelectedIndex() +``` + +## Collection:selectNext() + +Selects the next item in the collection + +### Returns +* `Collection` `self` The Collection instance + +## Collection:selectPrevious() + +Selects the previous item in the collection + +### Returns +* `Collection` `self` The Collection instance + ## Collection:onSelect(callback) Registers a callback for the select event diff --git a/docs/references/elements/List.md b/docs/references/elements/List.md index 4424c45..ab560a7 100644 --- a/docs/references/elements/List.md +++ b/docs/references/elements/List.md @@ -9,6 +9,12 @@ Extends: `Collection` |Property|Type|Default|Description| |---|---|---|---| |offset|number|0|Current scroll offset for viewing long lists| +|emptyText|string|"No|items" Text to display when the list is empty| +|showScrollBar|boolean|true|Whether to show the scrollbar when items exceed height| +|scrollBarSymbol|string|"|" Symbol used for the scrollbar handle| +|scrollBarBackground|string|"\127"|Symbol used for the scrollbar background| +|scrollBarColor|color|lightGray|Color of the scrollbar handle| +|scrollBarBackgroundColor|color|gray|Background color of the scrollbar| ## Events @@ -23,6 +29,7 @@ Extends: `Collection` |[List:onSelect](#list-onselect-callback)|List|Registers a callback for the select event| |[List:scrollToBottom](#list-scrolltobottom)|List|Scrolls the list to the bottom| |[List:scrollToTop](#list-scrolltotop)|List|Scrolls the list to the top| +|[List:scrollToItem](#list-scrolltoitem-index)|List|Scrolls to a specific item| ## List:onSelect(callback) @@ -52,3 +59,18 @@ Scrolls the list to the top ### Returns * `List` `self` The List instance + +## List:scrollToItem(index) + +Scrolls to make a specific item visible + +### Parameters +* `index` `number` The index of the item to scroll to + +### Returns +* `List` `self` The List instance + +### Usage +```lua +list:scrollToItem(5) +```