Skip to content

PullDownButton

A PullDownButton displays a menu of mutually exclusive options.

Component preview

Summary

Properties

Property Type Description
Options {[number]: string}? You can use this table to pre-define options. Note that doing it this way will not give you access to the option instances themselves.
Expanded boolean? Defines the state of the dropdown disclosure.
Label string? Shows a label next to the disclosure button. Use it to describe the menu's content.
Value number? The numeric index of the option to be selected.

View all inherited from BaseComponent

View all inherited from Frame

Methods

Method Signature Description
Option (Name: string?) -> Frame Can be used to seperately create options, use this if you want to access the option instances themselves.
Remove (Index: number?) -> nil, Can be used to remove options from the pull-down menu, this automatically removes it from the options list as well.

View all inherited from Frame

Events

Event Signature Description
ValueChanged ((self: PullDownButton, value: string) -> unknown)? A Callback function that is triggered when the Value property has been modified.

View all inherited from Frame

Types

type PullDownButtonProperties = Frame & {
    Options: { [number]: string }?,
    Expanded: boolean?,
    Label: string?,
    Value: number?,
    ValueChanged: ((self: PullDownButton, value: number) -> unknown)?,
}

type PullDownButton = BaseComponent & Components & PullDownButtonProperties & {
    Option: (Name: string?) -> Frame,
    Remove: (Index: number?) -> nil,
}

Function Signature

function(self, properties: PullDownButtonProperties): PullDownButton

Example

local pullDownButton = row:Right():PullDownButton({
    Label = "Action",
    Options = {
        "Action One",
        "Action Two",
    },
    ValueChanged = function(self, value: number)
        print("Action selected:", self.Options[value])
    end,
})

print(pullDownButton:IsA("Frame")) --> true
print(pullDownButton.ClassName) --> "Frame"
print(pullDownButton.Type) --> "PullDownButton"

pullDownButton.Value = 3 --> Value changed: "Item Three"

local itemThree = pullDownButton:Option("Item Three")

print(itemThree.ClassName) --> Frame
pullDownButton:Remove(13)