Skip to content

Button

A Button initiates an instantaneous action.

Component preview

Summary

Properties

Property Type Description
State ("Primary" | "Secondary" | "Destructive")? Determines the weight of the button. Suggests to the user it's impact to the content around it
Label string? The text content of the button.

View all inherited from BaseComponent

View all inherited from TextButton

Methods

View all inherited from TextButton

Events

Event Signature Description
Pushed ((self: Button) -> unknown)? A callback function that is triggered when the button has been fully clicked or tapped.

View all inherited from TextButton

Types

type ButtonProperties = TextButton & {
    State: ("Primary" | "Secondary" | "Destructive")?,
    Label: string?,
    Pushed: ((self: Button) -> unknown)?,
}

type Button = BaseComponent & Components & ButtonProperties

Function Signature

function(self, properties: ButtonProperties): Button

Example

local button = row:Right():Button({
    Label = "Button",
    State = "Primary",
    Pushed = function(self)
        print("Pushed")
    end,
})

print(button:IsA("TextButton")) --> true
print(button.ClassName) --> "TextButton"
print(button.Type) --> "Button"