Bird
Raised Fist0
Figmabi_tool~10 mins

Component library organization in Figma - Interactive Code Practice

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a new component in Figma.

Figma
const button = figma.create[1]();
Drag options to blanks, or click blank then click option'
ARectangle
BText
CFrame
DEllipse
Attempts:
3 left
💡 Hint
Common Mistakes
Using Text instead of Rectangle for button shape.
Trying to create a Frame instead of a basic shape.
2fill in blank
medium

Complete the code to add a component to the library.

Figma
const component = button.[1]();
Drag options to blanks, or click blank then click option'
Apublish
BcreateComponent
Cdetach
Dimport
Attempts:
3 left
💡 Hint
Common Mistakes
Using import instead of createComponent.
Trying to publish instead of createComponent.
3fill in blank
hard

Fix the error in the code to rename a component in the library.

Figma
component.[1] = 'Primary Button';
Drag options to blanks, or click blank then click option'
Aid
Btitle
Clabel
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'title' or 'label' which do not rename the component.
Trying to change 'id' which is unique and not editable.
4fill in blank
hard

Fill both blanks to create a variant set with two variants.

Figma
const variantSet = figma.create[1]();
variantSet.[2] = ['Primary', 'Secondary'];
Drag options to blanks, or click blank then click option'
AComponentSet
Bvariants
CvariantNames
DComponent
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Component' instead of 'ComponentSet' for variant sets.
Using 'variantNames' which is not a valid property.
5fill in blank
hard

Fill all three blanks to detach an instance and change its color.

Figma
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);
Drag options to blanks, or click blank then click option'
AdetachInstance
BSOLID
CappendChild
DremoveChild
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'removeChild' instead of 'appendChild' to add the detached node.
Using wrong fill type like 'GRADIENT' instead of 'SOLID'.

Practice

(1/5)
1. What is the main reason to organize components in a Figma library by type or function?
easy
A. To make it easier for users to find and reuse components quickly
B. To increase the file size of the library
C. To make components look more colorful
D. To prevent users from editing components

Solution

  1. Step 1: Understand component organization purpose

    Organizing by type or function groups similar components together logically.
  2. Step 2: Identify benefit for users

    This grouping helps users find components faster and reuse them efficiently.
  3. Final Answer:

    To make it easier for users to find and reuse components quickly -> Option A
  4. Quick Check:

    Organizing by type/function = easier reuse [OK]
Hint: Group similar components to find them faster [OK]
Common Mistakes:
  • Thinking organization increases file size
  • Believing organization changes component colors
  • Assuming organization restricts editing
2. Which of the following is the correct way to name components in a Figma library for clarity?
easy
A. Component123
B. Btn1
C. Button/Primary/Default
D. MyComponent

Solution

  1. Step 1: Review naming conventions

    Clear names use categories and states separated by slashes for easy browsing.
  2. Step 2: Compare options

    Button/Primary/Default uses descriptive hierarchy, others are vague or unclear.
  3. Final Answer:

    Button/Primary/Default -> Option C
  4. Quick Check:

    Clear, consistent names = Button/Primary/Default [OK]
Hint: Use slashes to separate categories in names [OK]
Common Mistakes:
  • Using short codes like Btn1
  • Using generic names like Component123
  • Using personal names like MyComponent
3. Given a Figma library with components named as Icon/Small/Active, Icon/Small/Inactive, and Icon/Large/Active, which component will appear first when sorted alphabetically?
medium
A. Icon/Large/Active
B. Icon/Small/Active
C. Icon/Small/Inactive
D. Icon/Active/Small

Solution

  1. Step 1: Understand alphabetical sorting

    Sorting compares strings from left to right character by character.
  2. Step 2: Compare component names

    "Icon/Large/Active" comes before "Icon/Small/Active" because "Large" starts with 'L' which is before 'S' in "Small".
  3. Final Answer:

    Icon/Large/Active -> Option A
  4. Quick Check:

    Alphabetical order = Icon/Large/Active first [OK]
Hint: Sort by first differing word alphabetically [OK]
Common Mistakes:
  • Ignoring alphabetical order and picking Small first
  • Confusing order of words in names
  • Choosing a name not in the list
4. You notice your Figma component library is hard to browse because many components have inconsistent naming like BtnPrimary, button_secondary, and BTN-Tertiary. What is the best way to fix this?
medium
A. Delete all components and start over
B. Add random numbers to each component name
C. Leave names as they are to avoid confusion
D. Rename all components using a consistent naming pattern like Button/Primary

Solution

  1. Step 1: Identify the problem

    Inconsistent naming makes browsing and finding components difficult.
  2. Step 2: Apply consistent naming

    Renaming with a clear pattern like "Button/Primary" improves clarity and organization.
  3. Final Answer:

    Rename all components using a consistent naming pattern like Button/Primary -> Option D
  4. Quick Check:

    Consistent naming fixes browsing issues [OK]
Hint: Use one naming style for all components [OK]
Common Mistakes:
  • Deleting components unnecessarily
  • Keeping inconsistent names
  • Adding confusing numbers
5. You are building a Figma component library for a large project with buttons, icons, and forms. How should you organize the library to keep it simple and easy to browse for your team?
hard
A. Put all components in one folder with random names
B. Create folders for each component type and use clear names like Button/Primary, Icon/Small, and Form/Input
C. Use only colors to differentiate components without naming
D. Create separate files for each component without naming conventions

Solution

  1. Step 1: Organize by component type

    Grouping components by type (buttons, icons, forms) helps users find them easily.
  2. Step 2: Use clear, consistent names

    Names like "Button/Primary" clearly describe the component and its purpose.
  3. Step 3: Keep library simple and browsable

    Folders and naming reduce clutter and improve navigation for the team.
  4. Final Answer:

    Create folders for each component type and use clear names like Button/Primary, Icon/Small, and Form/Input -> Option B
  5. Quick Check:

    Folders + clear names = simple, easy browsing [OK]
Hint: Group by type and name clearly for easy browsing [OK]
Common Mistakes:
  • Mixing all components without folders
  • Using colors only without names
  • Splitting components into many files without naming