Skip to main content
Jimmy_Moutzouris
Jul 11, 2023 7:02 AM UTC
Solved

Change a library component intance based on variable

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?

This topic has been closed for replies.
Avokadomos
AvokadomosSolution
Figma Ambassador
Jul 11, 2023 8:40 AM UTC

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

image

Disclosure: I’m part of Figma’s Forum Ambassador program.

7 replies

Avokadomos
Figma Ambassador
Figma Ambassador
Jul 11, 2023 7:25 AM UTC

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

Disclosure: I’m part of Figma’s Forum Ambassador program.
Jimmy_Moutzouris
Jul 11, 2023 8:39 AM UTC

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

Avokadomos
Figma Ambassador
AvokadomosSolution
Figma Ambassador
Jul 11, 2023 8:40 AM UTC

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

image

Disclosure: I’m part of Figma’s Forum Ambassador program.
Jimmy_Moutzouris
Jul 11, 2023 8:51 AM UTC

Thank you Champ

Avokadomos
Figma Ambassador
Figma Ambassador
Jul 11, 2023 10:02 AM UTC

No worries! Remember to mark this topic as resolved.

Disclosure: I’m part of Figma’s Forum Ambassador program.
Jimmy_Moutzouris
Jul 12, 2023 2:52 AM UTC

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
Figma Ambassador
Figma Ambassador
Jul 12, 2023 7:33 AM UTC

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

Disclosure: I’m part of Figma’s Forum Ambassador program.