Skip to content
Tutorials Center
My learning

Topics

Lesson 20 of 36 ยท Components and Variants

Component Properties

Use Figma component properties (boolean, text, instance swap and variant) to build flexible components with a clean, small control panel.

Overrides let you change anything on an instance, but they are scattered and easy to forget. Component properties solve that by exposing a short list of named controls at the top of the right panel. Instead of hunting through layers to hide an icon or edit a label, you flip a switch or type in a box.

Figma has four kinds of component property. Knowing which to use is half of building a good component.

The four property types

Type Controls Typical use
Boolean Shows or hides a layer "Show icon", "Has badge"
Text Edits the content of a text layer "Label", "Helper text"
Instance swap Replaces a nested instance with another component "Leading icon", "Avatar"
Variant Chooses one value from a set "Size", "State" (covered in Variants)

Create the first three from the main component. Select it, find the Properties section in the right panel and click the plus icon. Alternatively, select a single layer inside the component and click the small property icon next to its visibility, text or instance control; Figma links that layer to a new property for you.

Figma itself cannot run on this site. The code here is a labelled stand-in written in JavaScript that models properties so you can see how they combine. It is not Figma's real implementation.

Boolean properties

A boolean property toggles a layer's visibility. Build the full component with every optional part present, name each optional layer clearly (icon-left, badge), then link the layer to a boolean property. The default value is what a new instance shows.

Tips:

  • Name properties by what the user sees: Show icon reads better than bool1.
  • Booleans that are rarely used still cost nothing, because designers only look at them when needed.
  • Auto layout makes booleans painless: when a layer is hidden, the remaining items close the gap (hidden layers are ignored by auto layout).

Text properties

A text property links to one text layer. Editing the property edits the text, and the label in the panel tells the designer what the text is for. Set the default to a realistic example ("Continue") rather than "Label", because new instances then look right immediately.

You can still double-click the text on the canvas, but a text property is better in handoff: developers see a named string property. If a component has three text layers, give each one a property so they are all in one tidy list.

Instance swap properties

Use an instance swap when a slot holds another component, most often an icon. Create the nested icon instance inside the button, then link it to an instance swap property called "Icon". In the panel, a dropdown lets designers pick any component from your library.

To make the list useful, set preferred instances (the options that appear first). Make a set of icon components with the same size, such as 24 by 24, so swapping never changes layout.

flowchart TD
    B["Button component"] --> P1["Show icon (boolean)"]
    B --> P2["Label (text)"]
    B --> P3["Icon (instance swap)"]
    B --> P4["Size (variant)"]
    P1 -->|"controls visibility of"| L1["icon layer"]
    P3 -->|"swaps"| L1
    P2 -->|"edits"| L2["label layer"]

A good component exposes a few meaningful properties and hides the rest.

Modelling properties

The following stand-in builds a button description from its properties. It is plain JavaScript, so you can add your own cases.

JS Stand-in: a component with properties

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The last two calls show what Figma prevents for you: picking an icon that is not in the preferred list, or a property that does not exist. The UI never lets you make those mistakes.

How many properties is too many?

More properties mean more power but also more confusion. A useful budget is about four to six per component. If you need more, split the component. A card with eight booleans is usually three different cards.

JS Stand-in: a property budget checker

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Property naming conventions

  • Use sentence case and plain words: Show badge, not badgeVisible.
  • Keep the same names across components (Label, Icon, Size) so designers learn once.
  • Match design and code. If the React button has iconPosition, design it as "Icon position" so handoff is a direct translation.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which property type hides or shows a layer?

    A boolean property toggles layer visibility.
  2. 2. You want designers to pick any icon from your library for a button slot. Which property do you use?

    Instance swap replaces a nested component instance with another component.
  3. 3. What is a sensible default text for a button label property?

    Realistic defaults make new instances look right immediately.
  4. 4. A component has ten properties. What is the best next step?

    A large property list usually means one component is doing the job of several.

Summary

  • Component properties give instances a small, named control panel instead of scattered overrides.
  • Booleans show or hide, text properties edit strings, instance swaps replace nested components, variants pick from sets.
  • Keep to roughly four to six properties and name them in plain language that matches code.
  • Realistic defaults and consistent icon sizes make components easy to use.

Next: Variants