Skip to main content
Question

Get selected variant in instance from component

  • September 18, 2024
  • 0 replies
  • 41 views

edDes

So, let’s see…if I have a Figma file with let’s say 5 instances of the same library component, but with different variants:

Component Inst1–VarA *** Inst2–VarB *** Inst3–VarC *** Inst4–VarD *** Inst5 – VarF

If i need to import via plugin each of these instances to a new file, how do I exctract/find out…the selected variant and work out its key to be used in expressions like:

figma.importComponentByKeyAsync(key)

I am getting a bit lost in the Json response here…the Json response shows node children in pages with type: "INSTANCE" and another field a bit below componentId: “XXXX:XXXX” however, in the code TS reports Property 'componentId' does not exist on type 'InstanceNode'

This topic has been closed for replies.

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