Creating a three-state toggle slider switch/button

Hey everyone, hope all is well.

I’m hoping to try and create a slider/toggle button that has three states. As you can see in the image here:

When the user selects land/sea/air, the green shape should slide to the relevant spot which will then show a different form below.

I can’t figure out how to make an object ‘move’ or ‘slide’ at all in order to achieve this.

Does anybody know of a way of doing this at all? I was hoping that there may be a plugin which could do this but I can’t find anything either.

Any help is much appreciated!

Thank you!

I am pretty sure you won’t be doing the sliding thingy with built-in Bubble elements. (Not 100% at least).

However, with some tricks, you can get closer to the effect you want (still not 100%). See the demo below:

This is technically, just showing/hiding an empty green-background text element (it might have been any element, a group perhaps) behind the real text fields (with value).

There are four text elements in the page. Sea and Air are obviously text elements. Then, there are two more (the green ones) in the same spot as Sea and Air. The Sea background is visible first (as default state). Then, when you click on Air, you hide the sea background with an animation and show the air background with an animation:

And there is the state as well, to keep track of which one is pressed.

See how I just animate them when the background isn’t visible. Otherwise, it will show the sliding effect when clicked on selected ones again, which looks weird :slight_smile:

It can be done with three states as well. You will probably need 6 workflows (2 for each Text because you need to take the previous selected value into account as well. (Like if you came to Sea after the third one, you don’t touch the Air for example).

You can skip all the animation and it is pretty straight forward:

This one you probably can easily figure out. A custom state to keep the current one (therefore changed background conditionally) and the other 2 (or more states that can update this custom state on click).

Anyway, you can see both examples here in the editor: Tests for Forum 10 | Bubble Editor

Good luck.

1 Like

This is exactly what I was going to suggest earlier but wasn’t at a computer to try it out - nice work!

1 Like

Wow, this is amazing. Thank you so much for such a detailed response!

I’ve got it in and working now. Thanks again!

You can also follow this tutorial on how to create a three-state toggle switch.

The outcome of the switch from this tutorial is shown below:

Three State Toggle switch

This topic was automatically closed after 70 days. New replies are no longer allowed.