Create Variants Automatically
✓ Published0🌍 Public
KKevinGutowski
Last edited Jun 8, 2021
Created on Jun 8, 2021
This example shows a Figma plugin that automatically converts selected frame children into reusable component variants, organizing them into a vertical layout. The script iterates through each child frame, finds all matching glyphs by name across the page, and clones each into a new component with a renamed hierarchy based on the parent’s name. Using Figma’s `createComponent`, `clone`, and `combineAsVariants` APIs, it builds variant groups and sets their layout mode. The code demonstrates programmatic component creation and variant combination directly from the Figma document model.
AI-generated description