Figma Support Forum

Generating a component instance

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!

  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.

1 Like

Thanks Gleb, I’ll give this a shot!