Skip to main content
Question

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

  • December 8, 2023
  • 3 replies
  • 1072 views

Lisa8

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.

3 replies

Max_Humberstone

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.


Lisa8
  • Author
  • 1 reply
  • December 13, 2023

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.


itm
  • New Member
  • 4 replies
  • March 10, 2025

I’ve found order matters. Some actions cause later ones to be ignored. My best practices though I’m not sure if it’s a foolproof solution is to always have variables set before I do anything else (open overlays, navigate to, etc.)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings