Hi @Markus_Kegel
Is there a way to set multiple on click events on one element,
Nope, it can’t be done. Every interaction type are unique per element.
But when clicking on “Add Preset” it jumps directly to row 4.
This is because the conditions in your interaction are “useless”. They check if a variable is set to true right after having set that same variable to true
.
We could think that sometime the variable is false
, but it’s not possible because the 1st step of this interaction is settings the 2_visibility
to true which will then trigger all conditions.
There are few differentes ways of doing this (and I’m not going to describe them all) :
Reorganize + Safeguard
If you want all the logic with in a single button you’ll have to reorganize and check for position (as interaction are not aware of the component state)
Create a local number variable (let’s name it #stage
) set to 1
if stage == 1
2_visibility = true
if stage == 2
3_visibility = true
if stage == 3
4_visibility = true
preset_visibility = false
stage = stage + 1
We check which stage we’re one and update the visiblity for the next stage. And only after we’ve checked them all we update the stage.
Simple interaction
I don’t know the background of you application and what you need but given what I see, I’ll just make a simple component with 4 variants inside and link the “Add Preset” button to the next variant
Let me know if it helped
@Haroll
Awesome!! Thanks for your answer! This works totally out for me.
For sure it is way simpler to create some variants, but i am actually learning the advanced prototyping stuff in Figma and was just interested how this could work out for me.