Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a Frame in Figma.
Figma
const container = figma.currentPage.[1]({ name: 'Main Frame' });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using createGroup instead of createFrame
Confusing frames with components
✗ Incorrect
Use createFrame to create a Frame in Figma. Groups are created with createGroup.
2fill in blank
mediumComplete the code to create a Group in Figma.
Figma
const group = figma.currentPage.[1](nodes); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using createFrame instead of createGroup
Trying to create a group without nodes
✗ Incorrect
Use createGroup to group nodes together without layout constraints.
3fill in blank
hardFix the error in the code to add a child to a Frame.
Figma
frame.[1](child); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using addChild which does not exist
Using append which is not a Figma method
✗ Incorrect
Use appendChild to add a child node to a Frame or Group in Figma.
4fill in blank
hardFill both blanks to check if a node is a Frame or a Group.
Figma
if (node.type === [1] || node.type === [2]) { console.log('Node is a container'); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using COMPONENT or INSTANCE instead of FRAME or GROUP
Using lowercase strings instead of uppercase
✗ Incorrect
Frames have type "FRAME" and groups have type "GROUP" in Figma.
5fill in blank
hardFill all three blanks to create a Frame, add a child, and set layout mode.
Figma
const frame = figma.currentPage.[1]({ name: 'Container' }); frame.[2](childNode); frame.layoutMode = [3];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using createGroup instead of createFrame
Using addChild instead of appendChild
Setting layoutMode to an invalid value
✗ Incorrect
Create a Frame with createFrame, add a child with appendChild, and set layout mode to "HORIZONTAL" for horizontal auto-layout.