Creating a Toggle in Thunkable X


#1

You can create an on/off switch, also known as a toggle switch, in your app with a variety of different components and blocks in Thunkable X.

Switch

The switch component is probably the easiest to get started with.

When the switch is clicked, the value changes. The newValue variable is either true or false, depending on whether the switch is on or off.

In this example, a label is used to display the words “On” or “Off” depending on the position of the string.

05

Click to remix the “Toggl” app


Working with Times and Dates in Thunkable X
#2

Button

You can also combine buttons and variables to create a simple toggle like so:

25

In this example, in addition to changing the text on the button we also chance the value of the variable and the text colour in the button.

Click to remix the “Toggl” app


#3

If you want an option that doesn’t use variables then you can simply use the text on the button to detect the current position of the button.

44

If you combined this approach with some “else if” conditions then you can easily create a switch with several different positions.

Click to remix the “Toggl” app


#4

Expanding on the previous idea, you can toggle the background image of a component by doing something like this:

22

Click to remix the “Toggl” app