Skip to main content
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?

Best answer by step34

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.

View original
This topic has been closed for replies.

6 replies

tank666
  • 4873 replies
  • April 26, 2023

Parent is a required parameter in the combineAsVariants method.


How do you create a new component set otherwise?


tank666
  • 4873 replies
  • 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.


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
  • 4 replies
  • Answer
  • 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.


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


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