#Using VARIABLES for a Dropdown Checkbox - is there a simpler way than this guy's solution?

14 messages · Page 1 of 1 (latest)

ripe ibex
#

hi, i just watched this guide on making a complex dropdown: https://www.youtube.com/watch?v=uBCyA5Oz_eY

i was saddened to see that even with this latest new variable logic, it seems one still needs to do a lot of tedious configs and generate duplicated elements.

Is there a more optimal way besides the one in the video??

thanks in advance.

shell crest
#

Hey @ripe ibex ! So are you trying to have different results based on what checkbox is checked or not? I think variables for that are not there yet to make it too much better. It can reduce some complexity to it but not perfectly yet (but hopefully soon!)

I thin variables are most useful if you want to control something outside of the component (which in this case you do want) and if you also want it to control the outside thing the same way or similarly.

For example for this case it works really well:
https://www.figma.com/community/file/1261221430583572452
(this also has checkboxes, but if it is checked or not, it effects the outside element similarly)

#

For your case, I think it can be done in at least 3 different ways. Depending on how much variable interactions you want, and how much component variants you want

#

But variables are not always great and I have also found situations where I would rather not go with the variables. But there are also situations where variables are much better. I do see the possibility of variables being better for almost everything and working really well, but i think there is still a long way to gethere, and variables are still in beta you know, so theres definitely a lot of room for improvements!

ripe ibex
#

@shell crest wow thanks for sharing that. It helps to see the options. I noticed this warning "cant publish components w/ variables" - is that still a thing?

shell crest
ripe ibex
#

ok great.

shell crest
#

I could see that being a problem related to free vs pro plan but im not sure

ripe ibex
#

im assuming that is child's play right?

shell crest
# ripe ibex btw, just peeped this demo of yours for text fields: https://www.figma.com/commu...

Yeah you can definitely have this! You proably would like to have another variable eg. show_component that is a boolean. And then connect that boolean to the external component's visibility. And then on the Enter interaction just add another set variable action where you might do something like: if (show_component) then set variable sho_component== false, else set variable show_compoent == true

#

i think variables are great for modifying the state of external things - either if it is on the same page or another page!

#

it just gets tricky when you want the same component to change the external thing differently depending on the instance of the component (like in the youtube example where you want the different checkboxes to modify the grid of images differently)