Skip to content

Components

Button

A pressable control that reports a named action when it fires. Tints the Panel on its node for idle, hovered and pressed, and can show a picture of its own in each state. Pair it with a Panel and a Text label. Goes under a Canvas.

On this page

Add it

+ Add node → Button, Menu Button creates a node with it already on. Already have a node for it? Add component → ButtonComponent.

From a script

A script on the same node writes these fields by name. ButtonComponent is the name to pass.

rgs
set_text("ButtonComponent", "action", "");
set_flag("ButtonComponent", "disabled", false);
set_colour("ButtonComponent", "normal", vec4(0.2, 0.2, 0.24, 1.0));
set_colour("ButtonComponent", "hovered", vec4(0.3, 0.3, 0.36, 1.0));
set_colour("ButtonComponent", "pressed", vec4(0.12, 0.12, 0.15, 1.0));

Fields

FieldScript nameKindDefaultWhat it does
ActionactiontextemptyReported when this button fires, and read as held while a mouse or a finger holds it down.
DisableddisabledcheckboxoffWhen on, this button takes no input, and its face and the word on it dim.
Normalnormalcolour#33333dTint when idle.
Hoveredhoveredcolour#4d4d5cTint under the pointer, or when focused.
Pressedpressedcolour#1f1f26Tint while held.
Hovered Texturehovered_textureassetnoneShown instead of the Panel's picture while the pointer is over this button.
Pressed Texturepressed_textureassetnoneShown instead of the Panel's picture while this button is held down.
Disabled Texturedisabled_textureassetnoneShown instead of the Panel's picture while this button is disabled.