Skip to main content
Also has everything from ElementHandle. A clickable button. No value of its own, so use OnClick to run code.
ValueNone
Created bySection:AddButton

Creation

section:AddButton(label: string, icon: string?): ButtonHandle

SetIcon

button:SetIcon(icon: string?): ()
Change the button’s icon. Pass nil to remove.

OnClick

button:OnClick(callback: () -> ()): () -> ()
Run cb() when the button is clicked.
returns
() -> ()
Unsubscribe function.

RequireConfirm

button:RequireConfirm(prompt: string?, timeout: number?): ()
Make the button require two clicks: the first arms it, the second confirms. Default prompt is "Confirm?", default timeout is 2.5 seconds.

ClearConfirm

button:ClearConfirm(): ()
Cancel the armed state.

Click

button:Click(): ()
Trigger the click programmatically.
Also has everything from ElementHandle: labels, visibility, tooltips, and Destroy. There is no GetValue / OnChange on a button.

Example

local run = section:AddButton("Run once", "play")
run:OnClick(function()
    print("executed")
end)
run:RequireConfirm("Run this script?", 3)