Is it possible to label a button in some other way than using the "id"? I would like the text on the button to change depending on the toggle state.
You can change the button's label property (under style). To make it depend on the button's value you have two options:
-
write
#{ @{this} == @{this.on} ? 'on' : 'off' }
in the label property (see advanced syntaxes) -
write
VAR{label, defaultLabel}
in the label property and use scripting (onValue property) to modify the variable's value:
if (value === getProp(this, 'on')) {
setVar(this, 'label', 'ON')
} else {
setVar(this, 'label', 'OFF')
}
This is helpful. Thank you very much.