Complete the code to create a new component in Figma.
const button = figma.create[1]();In Figma, a button is often created as a Rectangle component.
Complete the code to add a component to the library.
const component = button.[1]();To add a component to the library, you create it with createComponent.
Fix the error in the code to rename a component in the library.
component.[1] = 'Primary Button';
The property to rename a component is 'name'.
Fill both blanks to create a variant set with two variants.
const variantSet = figma.create[1](); variantSet.[2] = ['Primary', 'Secondary'];
You create a variant set with createComponentSet and assign variant names using the 'variants' property.
Fill all three blanks to detach an instance and change its color.
const instance = figma.currentPage.findOne(node => node.type === 'INSTANCE'); const detached = instance.[1](); detached.fills = [{ type: '[2]', color: { r: 1, g: 0, b: 0 } }]; figma.currentPage.[3](detached);
To modify an instance, you detach it first, then set its fill color with type 'SOLID', and finally add it to the page with appendChild.
