AROYN UI LIBRARY / UI COMPONENTS

Button

Run an explicit action with a Primary or Secondary button.

Create Button#

Run an explicit action with a Primary or Secondary button.

The constructor returns a Button handle. The snippet assumes section exists, as created in Quick start.

LUAU
local button = section:CreateButton({
    Name = "Save preferences", Text = "Save", Variant = "Primary",
    Callback = function()
        local ok, info = window:SaveConfig("main")
        if not ok then warn(info.Code, info.Message) end
    end,
})

Arguments#

OptionTypeDefaultMeaning
TextstringNameButton caption; separate from the row label.
Variant"Primary" | "Secondary""Secondary"Neutral high-contrast primary or quiet secondary style.
Callbackfunction()nilCalled on activation. No value argument.

Also accepts common options: Name, Description and Disabled. Button does not register Flag, Persist or Sensitive for configuration.

Manage state#

LUAU
button:SetText("Save again")
print(button:GetText())
button:SetDisabled(true)

Returned methods#

MethodReturnsBehavior
GetText()stringCurrent button caption.
SetText(string)selfChanges the caption, not the row Name.
SetDisabled(boolean)selfPrevents user activation without changing the caption.
IsDisabled()booleanReads the requested disabled state.
Destroy()nilRemoves this control and its subscriptions; safe to repeat.

Behavior and limitations#

A Button has no persistent value or GetValue / SetValue contract. Flag does not make an action persistable.

Callback errors warn; the library does not promise success for your action. Disabled prevents user activation.