Skip to content
tezvyn:
Menu

Figma Variables: Grouping Primitives with Collections

Source: help.figma.comMediumHow cards are made

Think of Figma variables as raw ingredients. A collection is a recipe book ('Spacing') and modes are variations ('Mobile'). This lets you manage design tokens, themes, and responsive layouts.

Why it exists

Design systems need to manage not just component styles, but the raw, primitive values that build them—like a specific gray, a corner radius, or a spacing unit. Variables were created to manage these primitive values systematically, especially across different contexts like light/dark themes or mobile/desktop layouts, making systems more efficient and scalable.

The mental model

Think of variables as raw ingredients, collections as a recipe book, and modes as variations on a recipe. A variable is a single value, like a hex code #FFFFFF or a number 8. A collection groups related variables, like a 'Spacing' system. Modes define different contexts for that collection, like 'Compact' vs. 'Spacious'. When you apply a variable, you're applying a role that can change its value based on the active mode.

How it works

Figma supports four variable types: Color, Number, String, and Boolean. You organize them inside Collections. For example, you can create a 'Theming' collection with two modes: 'Light' and 'Dark'. Inside, you create a Color variable called 'ui-background'. You then set its value to a light color for the 'Light' mode and a dark color for the 'Dark' mode. When you apply this 'ui-background' variable to a frame's fill, changing the frame's mode will automatically switch the color.

When to use it

Use variables to manage a system of design tokens for color, spacing, sizing, and typography. They are essential for building multi-theme designs (like light and dark mode), creating responsive layouts with different values for mobile and desktop, and managing text for localization with string variables.

When not to use it

Do not use a single variable when you need to apply a bundle of different properties at once. For that, use Styles. A style can define a fill color, a stroke, and a drop shadow together. A variable can only control one of those primitive values at a time, such as the fill color OR the shadow's blur radius, but not both simultaneously.

One canonical example

To create a button that adapts to screen size, create a 'Layout' collection with 'Desktop' and 'Mobile' modes. Create a number variable called 'button-padding'. Set its value to 16 for the 'Desktop' mode and 12 for the 'Mobile' mode. Apply this variable to the button's padding. Now, placing the button inside a frame set to 'Mobile' mode will automatically shrink its padding.

Interview question

What is the primary function of a 'mode' within a Figma variable collection?

  • a.To categorize variables by their type, such as Color or Number.
  • b.To specify different values for variables based on a particular context or scenario.Correct
  • c.To establish a single, unchangeable value for a primitive design token.
  • d.To define a set of bundled design properties that can be applied together.
Why?

Modes define different contexts for a variable collection, allowing a single variable to have different values for scenarios like 'Light' vs. 'Dark' themes or 'Mobile' vs. 'Desktop' layouts. Option D describes Figma Styles, which bundle multiple properties, not variables or variables.

Just read this? Test yourself on what you have been reading.

Read the original → help.figma.com

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on figma — each one lists the topics its interview covers.

See open roles