Change variant of a component from a different component

I would really like to understand how it is possible, if at all to control one component from a completely different one.

For example, I have a button that I want to change the variant of a completely different component. the button can’t be in the same component or set of components.

I read on conditional statements and interactive components, but this is not at all what I am looking for even though some people said this is the solution in other older posts I read.

All i want is that when clicking on component A, it will change component B variant.
Is this possible already or still not?

1 Like

Variables and advanced prototyping is what you need. And it’s already available now. Just create a variable and bind it to the property in the instance whose variant you want to change. Then add a click interaction on some other object, in which set up a “Set variable” action to change the value of the variable.

4 Likes

Thank you! I google and googled, and nothing came up that explined that clearly enough, , funny how your 3 sentences made it clear to me finally!

Do you know though if it’s possible to use the smart animate feature in conjunction with the conditional statements?

thanks again!

Yes, of course, some actions inside conditional blocks support the “Smart animate” feature.

Hey, do you know by any chance what actions are supported with animations?
The only one I could see were supported are the ones that are already set on same component / component set, so if you use a variable to trigger a different component, I could not see any animation support. Am I missing something?

Many thanks! again

Smart animate is supported in the following actions:

  • Navigate to;
  • Change to;
  • Scroll to;
  • Open overlay;
  • Swap overlay.

So it works only on the same component,
Kind of make the whole set variable useless for a lot of cases.

Would be nice to have just a simple trigger to another component the way you can do on the same component instead of the whole variable thing.

I feel like it’s a very convoluted way of doing things and this could have been solved much more elegantly, but it is what it is. Shame.

Thank you regardless.

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.