code • Figma components with props - martindubenet/wed-dev-design GitHub Wiki

Figma 101  ][  Figma components with props  ][  Figma for React code  ]

Figma components with props

Building flexible components with "slots"

We often find ourselves creating lots of different variations of similar components, this can be tedious and difficult to maintain. Using a technique called « slots », we can swap out components very easily from a single component. This gives our teams flexibility to create new designs whilst still using the guidelines from our design system.

Props as in « Available Properties »

Instead of displaying all of your component's variants in a Design System file since we can now rely on properties, just as developers do within their ReactJS or VueJS templating files. The advantage with this feature is that the component now contains all his allowed variants within himself.

So everytime a new version of that component is saved and pushed on Figma's server everywhere the component is used gets the added features (and fixes).

4 types of properties

Type Description UI within Figma's right sidebar
Instance Swap Dropdown
Text Text input
Bolean Switch (toggle)
Variant A duplicated (child) component that either is styled differently according to the parent in which he is used, or is an interactive component.

Component properties can be created from two levels: the parent layer or the child layer of a main component or component set. Learn about the relationship between parent and child layers →

Managing existing components

Figma documentation

 

Video tutorials

Component properties video tutorial from Figma's YouTube channel

Play with Figma's Component Properties Playground file while following the tutorial.

  1. 01:18 - Introduction to the 4 Types of properties
  2. 02:32 - Instance swap property
  3. 03:39 - Text property
  4. 04:07 - Boolean property
  5. 05:24 - Apply component properties
  6. 05:53 - Variant property
  7. 07:36 - Example of editing an E-commerce card component
  8. 09:26 - Add component properties to an existing variaty of buttons from a Design System
    1. 12:04 - Set-up a Left icon
    2. 12:58 - Set-up the Right icon
    3. 14:18 - Set-up the text layer
    4. 16:07 - Clean up by removing obsolete props