Also has everything from ElementHandle.
A list to pick from. In single-select mode the value is one string; in multi-select mode it’s a list of strings.
| |
|---|
| Value type | string (single) or { string } (multi) |
| Created by | Section:AddDropdown |
Creation
section:AddDropdown(key, label, options, default?)
The list of choices. Order is preserved.
SetOptions
dropdown:SetOptions(options: { string }): ()
Change the list of choices.
SetMode
dropdown:SetMode(mode: "single" | "multi"): ()
Switch between single-select and multi-select.
SetMin / SetMax
dropdown:SetMin(min: number): ()
dropdown:SetMax(max: number?): ()
In multi-select, the smallest / largest number of choices the user must pick. nil removes the cap.
SetPlaceholder
dropdown:SetPlaceholder(text: string): ()
Text shown when nothing is selected.
SetSelected
dropdown:SetSelected(value: string | { string }): ()
Set the selection: a string in single mode, a list in multi.
Toggle
dropdown:Toggle(option: string): ()
In multi mode: add or remove that option. In single mode: pick it and close.
IsSelected
dropdown:IsSelected(option: string): boolean
Open / Close
dropdown:Open(position: UDim2?): ()
dropdown:Close(): ()
Open or close the popup from code.
WasJustClosed
dropdown:WasJustClosed(): boolean
True for about 0.1s after the dropdown closed. Use this to swallow the click that just dismissed it.
Example
local lang = section:AddDropdown("lang", "Language", { "EN", "FR", "DE" }, "EN")
lang:SetMode("multi")
lang:OnChange(function(sel)
print("selected:", sel)
end)