Skip to main content

Switch

Displays a toggle switch.

KeyTypeDescriptionRequiredDefaultMin Version
negatebooleanInvert the displayed state–false–
trueValueprimitiveValue to save when switch is true (defaults to true)–true–
falseValueprimitiveValue to save when switch is false (defaults to false)–false–
Return TypeDescription
primitiveMatches the switch state; if negate is true, the saved value is inverted. If set, trueValue/falseValue override the saved value.

Theme

Theme KeyTypeDescription
offTintColorColorTrack color when off
onTintColorColorTrack color when on
thumbTintColorColorThumb color

Example​

{
default = true;
label = "Enable feature";
cell = "Switch";
key = "enabled";
};
{
default = false;
label = "Switch with icon";
cell = "Switch";
key = "enabled1";
icon = "res/16.png";
readonly = true;
};

XUI-Switch.png