Complete the code to create a variant set named 'Button' in Figma.
const buttonVariant = figma.createComponentSet();
buttonVariant.name = [1];The variant set name should be 'Button' to group button variants properly.
Complete the code to add a variant property named 'State' to the component set.
buttonVariant.[1] = { 'State': ['Default', 'Hover', 'Pressed'] };
The property to define variant properties is 'variantProperties' in Figma API.
Fix the error in the code to set the variant property value to 'Hover'.
const variant = buttonVariant.children[0]; variant.[1] = {'State': 'Hover'};
The correct property to set a variant's property value is 'variantProperties'.
Fill both blanks to create a new variant with 'Pressed' state and add it to the variant set.
const newVariant = figma.[1](); newVariant.[2] = {'State': 'Pressed'}; buttonVariant.appendChild(newVariant);
Use 'createComponent()' to create a new variant and set its 'variantProperties' to {'State': 'Pressed'}.
Fill all three blanks to filter variants with 'Default' state and map their names.
const defaultVariants = buttonVariant.children.filter(v => v.[1].State === [2]).map(v => v.[3]);
Filter by 'variantProperties.State' equal to 'Default' and map to each variant's 'name'.