Actions that set variables don't work on nested components?

When I assign an action to a nested instance in a component which sets a variable it doesn’t seem to work. The component’s variant changes, but the variable is never changed. There are no warnings or errors.

When assigning the same action to the outer component it does set the variables.

An example:

This somehow feels related to the following limitation:

Variables can only be applied to top-level instances, and are not available for nested variant instances.

Mentioned here: Use variables in prototypes

2 Likes

Change the order of the actions so that “Set variable” is first in the list.

2 Likes

Thanks @tank666 that works!

1 Like

Figma, Variables is a great idea and a step forward, but in its current state it’s very limited so much that it misses the point. For example, using variables and the new ‘wrap’ auto-layout, I managed to reduce 8 component variants to 1 frame. But, I am not able to turn this frame into a component since it contains two (nested) components, to which I wanted to be able to assign a variable to auto set THEIR selected variant… I know this is confusing, but the point is, VARIABLES should work EVERYWHERE, including nested components, otherwise in many cases it’s unusable. Is there a plan to fix this in the future?

17 Likes

thank you! Thank you!