Skip to main content
Solved

Change variant of a component from a different component


Bez1

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?

Best answer by tank666

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.

View original
This topic has been closed for comments

7 replies

tank666
  • 4858 replies
  • Answer
  • July 25, 2023

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.


Bez1
  • Author
  • 9 replies
  • July 25, 2023

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!


tank666
  • 4858 replies
  • July 25, 2023

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


Bez1
  • Author
  • 9 replies
  • July 26, 2023

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


tank666
  • 4858 replies
  • July 26, 2023

Smart animate is supported in the following actions:

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

Bez1
  • Author
  • 9 replies
  • July 26, 2023

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.


  • 0 replies
  • August 25, 2023

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


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