Skip to main content

Button

Properties

PropertyTypeDescription
textstringText displayed on the button
typeprimary, default, dashed, text, linkThe type of button
iconstringThe Icon of the button
sizedefault, large, smallSize of the button
disabledbooleanWeather the button is disabled
loadingbooleanLoading indicator for the button
ghostbooleanMakes the buttons background transparent
blockbooleanMakes the buttons width fit its parents width
dangerbooleanMakes the button "warning" red
shapedefault, circle, roundShape of the button
customButtonbooleanWhen true, will be a button without any styling
[events]functionPlease read the events page
List of Icons.

You can see more properties here.

Children

Not supported on button - use the text property for setting the text of the button.

Example

local btn = myUi:createElement("Button", {
text = "Hello, World!",
icon = "CaretRightOutlined",
loading = true,
onClick = function(uiName, elementId, event)
print("Hello, World! Button was Clicked")
end
})

This is how the example looks in-game:

Showcase

Its icon property is overwritten because ghost is active.

Type

There are primary button, default button, dashed button, text button and link button in antd.

Showcase

List of Icons.

Icon

Buttons can contain an icon.

Showcase

Size

Buttons can have different sizes. default, large or small.

Showcase

Disabled

Buttons can be disabled, so the user is unable to press the button.

Showcase

Loading

A loading indicator can be added to a button. Also makes the user unable to press the button.

Showcase

Ghost

Ghost property will make button's background transparent.

Showcase

Blocks

Will make the button fit to its parent width.

Showcase

Danger

Makes the button "warning" red.

Showcase

customButton

When set to true the button will be a default HTML button without any styling.