Skip to content

Components

Toggle

A checkbox: pressing it flips a value and reports the new one — full screen, subtitles, invert Y. When on, it draws the box smaller inside itself, or its On Texture in place of the Panel's picture. Goes under a Canvas.

On this page

Add it

+ Add node → Toggle creates a node with it already on. Already have a node for it? Add component → ToggleComponent.

From a script

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

rgs
set_text("ToggleComponent", "action", "");
set_flag("ToggleComponent", "on", false);
set_flag("ToggleComponent", "disabled", false);
set_colour("ToggleComponent", "normal", vec4(0.2, 0.2, 0.24, 1.0));
set_colour("ToggleComponent", "hovered", vec4(0.3, 0.3, 0.36, 1.0));
set_colour("ToggleComponent", "pressed", vec4(0.12, 0.12, 0.15, 1.0));
set_colour("ToggleComponent", "check", vec4(0.85, 0.85, 0.9, 1.0));
set_number("ToggleComponent", "check_inset", 6.0);

Fields

FieldScript nameKindDefaultWhat it does
ActionactiontextemptyReported with the new value when this flips.
OnoncheckboxoffWhether it is on. This is saved, unlike a button's pressed state, which is just what the pointer is doing right now.
DisableddisabledcheckboxoffWhether it accepts input.
Normalnormalcolour#33333dTint when idle.
Hoveredhoveredcolour#4d4d5cTint under the pointer, or when focused.
Pressedpressedcolour#1f1f26Tint while held.
Checkcheckcolour#d9d9e6Colour of the mark drawn inside when it is on.
Check Insetcheck_insetnumber, at least 06How far the check mark sits inside the edge of the box.
On Textureon_textureassetnoneShown instead of the Panel's picture, and instead of the check mark, while this is on.