[solved] Is there a way to set variable and change to different variant of a component at the same time?

Dear Figma community,

I’d like to do two actions on click of a checkbox:

  1. set a variable to increase a counter
  2. change the component variant to a different variant that has a checked checkbox.

Just looking at the interface Figma seems to allow me to do this and add the change to. However when I try to change the status from “default” to “selected”, it automatically switches back after I select “selected”. Why could this be? Does anyone have an idea?

Thank you for your help!

Update: I got it to work by removing and adding it back a few times. Not sure what happened there.

1 Like

How did you get this to work? I’ve tried deleting and adding many times but it just keeps switching back to the current variant.

I frankly don’t know, I tried out many many times of removing and adding back and at some point it worked. I think it also had to do with the order in which I added but just assumptions.