Skip to main content
Solved

Change a library component intance based on variable


Jimmy_Moutzouris

In my main file im pulling a external style sheet which controls light/dark mode which all works fine. Im also pulling in graphics (logos, illustrations etc) from a different library. This library has component with 2 instances of the same illustration (light and dark).

What I want to do is from my main file toggle a variable which swaps all the graphic instances? Is this possible?

Best answer by Avokadomos

On the instance, click on assign variable (only visible when you hover the section).

image

View original
This topic has been closed for comments

7 replies

Avokadomos
  • Active Member
  • 377 replies
  • July 11, 2023

You can apply a text variable to the instance’s variant property, and then set the text variable to any variant name.


Jimmy_Moutzouris

How do you apply a variable to an instance variant property?


Avokadomos
  • Active Member
  • 377 replies
  • Answer
  • July 11, 2023

On the instance, click on assign variable (only visible when you hover the section).

image


Jimmy_Moutzouris

Thank you Champ


Avokadomos
  • Active Member
  • 377 replies
  • July 11, 2023

No worries! Remember to mark this topic as resolved.


Jimmy_Moutzouris

Before I close this, any way to apply the instant variant property to an instance that is within another component? Seems like not possible?


Avokadomos
  • Active Member
  • 377 replies
  • July 12, 2023

That is correct. Variables can’t be used in nested components, at least yet.


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