Skip to main content
Question

Generating a component instance


javieralaves

Hey all, I’d like to be able to do the following through a plugin:

  • Specify an existing component I want to make an instance of
  • Specify the component variant properties through a form in the plugin UI
  • Specify where to place the instance within a selected frame

I’ve looked into a few introductory videos but I can’t figure out at a quick glance whether this is even possible, and if it is, what learning resources or functions I should be aware of.

Any help would be appreciated. Thank you!

2 replies

Gleb
  • Power Member
  • 4707 replies
  • May 31, 2021
  1. Create instance of a component: ComponentNode · Figma Developers (don’t confuse with ComponentSetNode · Figma Developers)

  2. Parse the component name to get the variant properties (but you probably need to first parse and then create instance instead of swapping it).

  3. Append instance to the frame: FrameNode · Figma Developers

  4. Move instance by modifying its x and y values.


javieralaves

Thanks Gleb, I’ll give this a shot!


Reply


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