Solved
tank666Solution
May 30, 2023
I’m sorry but your code is not complete enough to test the functionality.
Here is a code snippet for creating components and combining them as variants.
let arr = [],
x = 0;
for (let i = 0; i < 8; i++) {
const component = figma.createComponent();
component.name = 'Value ' + (i + 1);
component.fills = [{
type: 'SOLID',
color: {
r: Math.random(),
g: Math.random(),
b: Math.random()
}
}];
if (i > 0) {
x += component.width + 20;
component.x = x
}
arr.push(component)
}
figma.combineAsVariants(arr, figma.currentPage)
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

