Skip to main content
Question

Swapping between variants from two different components

  • September 9, 2024
  • 3 replies
  • 20 views

masiqisme

I’ve created two separate components (dummy-pages-1 and dummy-pages-2) with three color variants each.
I’m using a ‘selectedPage’ variable to swap between variants of dummy-pages-1 on button clicks, but I can’t get the buttons for dummy-pages-2 variants to work.
How can I modify my setup to allow switching between variants from both components using a single instance on the stage?

This topic has been closed for replies.

3 replies

Raphael_M
  • Power Member
  • 394 replies
  • September 9, 2024

Try merging them? If they’re the same they shouldn’t be in 2 different sets.


masiqisme
  • Author
  • 1 reply
  • September 9, 2024

Is there a workaround to avoid merging these components, as I plan to keep them in separate page?


Raphael_M
  • Power Member
  • 394 replies
  • September 9, 2024

You can merge them and add another property called page if you want to set it up per page. On development, they might try to use the same component (they’ll merge them) anyways.

And, they should work the same if you’re using selectedPage as a string variable (no matter what page are they).

e.g.
Button 1.on click = set variable “selectedPage” to “blue”,
Button 2.on click = set variable “selectedPage” to “yellow”,
Button 3.on cick = set variable “selectedPage” to “red”,
Button 4.on click = set variable “selectedPage” to “purple”,
Button 5.on click = set variable “selectedPage” to “green”,
Button 6.on click = set variable “selectedPage” to “pink”

There might be issue directly on your prototyping settings, because they should work. I can’t know until i see the prototype settings.


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