Skip to main content
April 26, 2023
Solved

combineAsVariants to create a new component set?

Is there a way to create a completely new component set by using the combineAsVariants function? So without using the second parameter to define the parent?

This topic has been closed for replies.
step34
step34Solution
April 26, 2023

Hi,

I had the same issue the first time I ever started using this method.

For the easiest way to do this you can set the parameter to “figma.curentPage” and it will simply make the set in the page you are now:
figma.combineAsVariants(components, figma.currentPage);

Other options are any other page or frame.

6 replies

tank666
April 26, 2023

Parent is a required parameter in the combineAsVariants method.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
April 26, 2023

How do you create a new component set otherwise?

tank666
April 26, 2023

Why don’t you want to use the combineAsVariants method?

Another way to create a new component set is to clone an existing ComponentSetNode.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
April 26, 2023

Thanks for the tip on cloning an existing ComponentSetNode!

On the combineAsVariants method, just lost on what I can set the Parent argument to without having an existing set. I have multiple components that I want to combine into a new set through a script.

step34
step34Solution
April 26, 2023

Hi,

I had the same issue the first time I ever started using this method.

For the easiest way to do this you can set the parameter to “figma.curentPage” and it will simply make the set in the page you are now:
figma.combineAsVariants(components, figma.currentPage);

Other options are any other page or frame.

April 26, 2023

Thank you! This is what I needed. It went completely over my head.