This commit is contained in:
NoryiE
2025-10-29 16:56:08 +00:00
parent 9a5b46138e
commit 00a9ce5632
26 changed files with 812 additions and 77 deletions

View File

@@ -3,6 +3,56 @@ _A collapsible selection menu that expands to show multiple options when clicked
Extends: `List`
## Usage
```lua run
-- Create a styled dropdown menu
local dropdown = main:addDropDown()
:setPosition(5, 5)
:setSize(20, 1) -- Height expands when opened
:setSelectedText("Select an option...")
-- Add items with different styles and callbacks
dropdown:setItems({
{
text = "Category A",
background = colors.blue,
foreground = colors.white
},
{ separator = true, text = "-" }, -- Add a separator
{
text = "Option 1",
callback = function(self)
-- Handle selection
basalt.debug("Selected Option 1")
end
},
{
text = "Option 2",
-- Custom colors when selected
selectedBackground = colors.green,
selectedForeground = colors.white
}
})
-- Listen for selections
dropdown:onChange(function(self, value)
basalt.debug("Selected:", value)
end)
```
## Table Types
### ItemTable
|Property|Type|Description|
|---|---|---|
|text|string|The display text for the item|
|callback|function|Function called when selected|
|fg|color|Normal text color|
|bg|color|Normal background color|
|selectedFg|color|Text color when selected|
|selectedBg|color|Background when selected|
## Properties
|Property|Type|Default|Description|