Skip to content
Tutorials Center
My learning

Topics

Lesson 21 of 36 ยท Components and Variants

Variants

Learn how Figma variants group states like size, type and hover into one component set, with naming rules and how to spot missing combinations.

A button is not one thing. It has sizes (small, medium, large), types (primary, secondary), and states (default, hover, disabled). Without a good tool you would end up with dozens of separate components. Variants let you keep all of those versions inside a single component set and choose among them with dropdowns.

A component set is a container (shown with a dashed purple border) holding many variant components. Each variant has a property (for example "Size") with a value (for example "Large"). One variant exists for each combination you need.

Figma cannot run on this site. The examples use labelled JavaScript stand-ins that model variants and component sets, so you can explore naming and combinations. They are not Figma's own code.

Creating variants

  1. Build one component, for example a button, as a main component.
  2. In the right panel click the plus next to Variants, or choose Add variant to duplicate it inside a component set.
  3. Select a variant, rename its properties in the panel: change "Property 1" to Size and set the value, then add another property such as State.
  4. Edit each variant to look right (a hover button gets a darker fill; a disabled one gets reduced contrast).

You can also select several existing components and choose Combine as variants. Figma builds the set and parses names like Size=Large, State=Hover into properties automatically.

Instances of a variant component show dropdowns for every property, so a designer picks Size = Small and State = Disabled without touching layers.

Naming rules

Variant names follow Property=Value, Property=Value. For example:

TEXT
Type=Primary, Size=Medium, State=Default
Type=Primary, Size=Medium, State=Hover
Type=Secondary, Size=Small, State=Disabled

Good practice:

  • Keep property names short and consistent across components (Size, State, Type).
  • Order values naturally (Small, Medium, Large), because dropdowns follow variant order.
  • Use only properties that change the appearance. Content changes belong in component properties.

Counting combinations

Variants multiply. Three types, three sizes and four states make 36 variants, which is a lot to maintain. The design system skill is deciding which combinations are real. The stand-in below generates every combination, and lists those you have not built.

JS Stand-in: variant matrix and missing combinations

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

No output.

If a combination makes no sense (a disabled button never needs a hover), do not create it. If someone does need it later, Figma will show a "missing variant" gap in the dropdown and you can add it.

Variants versus properties

Both let designers configure an instance, so choose by what changes:

If the change is... Use
A different layout, color or shape (Large vs Small) Variant
A user-edited string Text property
Show or hide an optional layer Boolean property
Swapping a nested component Instance swap

A tab bar with five tabs does not need five variants for "which tab is selected" unless each tab looks different when selected. Often a single Selected = True/False variant on a tab component, used five times, is cleaner.

flowchart LR
    S["Component set: Button"] --> A["Type=Primary"]
    S --> B["Type=Secondary"]
    A --> A1["Size=Small"]
    A --> A2["Size=Medium"]
    A1 --> A1a["State=Default"]
    A1 --> A1b["State=Hover"]

Each path from the set to a leaf is one variant.

Switching variants in a prototype

Variants can react to interaction. Select a variant, open the Prototype tab and add an interaction from State=Default to State=Hover on mouse enter, using Change to. This is how you build interactive components, which you will learn about in Triggers and Actions. The component behaves on its own wherever it is used.

Handling many states: a naming linter

A common problem is inconsistent naming such as size=large mixed with Size=Large. Casing and spacing differences create duplicate properties.

JS Stand-in: variant name linter

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

No output.

Practical advice

  • Start with the properties that are visually different. Add more only when a screen needs them.
  • Keep the same dimensions for all variants where possible, so swapping states does not shift neighbors.
  • Use auto layout inside each variant so labels and icons resize correctly.
  • Document the allowed combinations next to the set in a note, so developers know which states exist.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is a component set?

    A component set groups variants, shown with a dashed purple border.
  2. 2. Which variant name format does Figma use?

    Variant names use Property=Value pairs separated by commas.
  3. 3. A component has 3 types, 3 sizes and 4 states. How many variants are possible?

    3 x 3 x 4 = 36 combinations, which is why you should build only the real ones.
  4. 4. Which belongs in a text property rather than a variant?

    Content that users edit belongs in text properties; variants describe alternative looks.

Summary

  • Variants collect different looks of one component into a component set.
  • Properties and values follow the Property=Value naming format.
  • Variants multiply quickly, so build only the combinations you need.
  • Use variants for looks, and component properties for content, visibility and swaps.
  • Variants can react to interaction to create interactive components.

Next: Nested Components and Swapping