Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a frame in Figma.
Figma
const frame = figma.create[1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using createCircle instead of createFrame
Using createText when a frame is needed
✗ Incorrect
In Figma's plugin API, createFrame() creates a new frame node.
2fill in blank
mediumComplete the code to set the width of a frame to 300 pixels.
Figma
frame.[1] = 300;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using height instead of width
Using size which is not a direct property
✗ Incorrect
The width property sets the horizontal size of the frame in pixels.
3fill in blank
hardFix the error in the code to add a rectangle inside the frame.
Figma
const rect = figma.createRectangle();
frame.[1](rect); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using append which is not a method in Figma nodes
Misspelling appendChild
✗ Incorrect
The correct method to add a child node in Figma is appendChild().
4fill in blank
hardFill both blanks to set the fill color of a rectangle to red.
Figma
rect.fills = [{ [1]: { r: 1, g: 0, b: 0 }, [2]: 1 }]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using alpha instead of opacity
Using fill inside the fill object
✗ Incorrect
The color property defines the RGB values, and opacity sets transparency.
5fill in blank
hardFill all three blanks to create a text node, set its content, and add it to the frame.
Figma
const text = figma.create[1](); text.characters = [2]; frame.[3](text);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Rectangle instead of Text
Forgetting quotes around text content
Using append instead of appendChild
✗ Incorrect
Create a text node with createText(), set its characters, then add it to the frame with appendChild().