Figma variables

On this page 7

Figma variables are named, reusable values stored in a Figma file and bound to design properties such as fill color, spacing, corner radius, text content or layer visibility. In a design workflow, they act as the source of truth for design decisions: when a variable changes, every layer that references it updates at once.

Figma introduced variables in 2023 as a native way to express design tokens, theming and prototype logic without plugins. They sit between visual styles and code: designers apply them on the canvas, and developers can read their names and code syntax in Figma Dev Mode, which makes variables a central element of a modern design-to-code process.

How Figma variables store and resolve values

A Figma variable holds one raw value per mode, and a layer bound to the variable displays the value of the mode currently applied to it. Variables are grouped into collections, and each collection defines its own set of modes, such as Light and Dark or Compact and Comfortable. Applying a mode to a frame or page switches every bound property inside it.

Variables can also alias other variables. A semantic variable such as color/text/primary may point to a primitive variable such as gray/900 in light mode and gray/50 in dark mode. This two-tier token structure separates the raw palette from the meaning of each value and keeps theme changes predictable.

Figma supports four variable types, each suited to different properties.

Variable typeTypical bindingsExample value
ColorFills, strokes, text color, effects#1A73E8 or an alias
NumberSpacing, padding, radius, size, font size16
StringText content, font family, font styleInter
BooleanLayer visibility, variant propertiestrue
Variable types and the properties they control

Collections, modes and scoping

The structure of collections determines how maintainable a variable system remains as it grows. Most teams separate primitives, semantic tokens and component tokens into different collections, because modes belong to a collection and a primitive palette rarely needs modes at all.

The table below shows a common collection architecture and the role each layer plays.

CollectionContentTypical modes
PrimitivesRaw palette, spacing scale, radiiNone or a single mode
Semantic tokensAliases with meaning, such as surface or borderLight, dark, high contrast
Brand themesBrand-specific aliasesOne mode per brand
DensitySpacing and size aliasesCompact, default, comfortable
Common collection architecture in a design system

Scoping limits where a variable appears in the property pickers. A number variable scoped to gap and padding will not be offered for corner radius, which reduces accidental misuse. Hiding primitives from publishing keeps consumers of a library focused on semantic tokens instead of raw values. The number of modes per collection depends on the Figma plan, so large multi-brand systems should confirm the limit before committing to a structure.

Figma variables compared with styles and design tokens

Variables hold single raw values, whereas styles can hold composite values such as gradients, layered shadows or complete typography settings. The two features complement each other: a text style can bind its font size and line height to number variables, and a color style can reference a color variable.

The following comparison clarifies where each concept belongs in the workflow.

ConceptValue structureMain strength
Figma variablesOne value per mode, aliasableTheming, modes and prototype logic
Figma stylesComposite visual propertiesGradients, effects and typography sets
Design tokensPlatform-neutral named valuesShared source for code and design
Component variantsAlternative component statesStructural changes in components
Variables, styles and design tokens compared

Variables are not identical to design tokens. Tokens are a platform-neutral concept usually stored as JSON, for example in the format drafted by the W3C Design Tokens Community Group. Variables are Figma’s implementation inside the file, and teams typically synchronize them with a token repository through the Figma REST API, plugins or export scripts.

Variables in interactive prototypes

Variables turn prototypes from static screen links into stateful simulations. A prototype action can set a variable, and other layers react to its new value. With conditional logic and expressions, a single frame can count items in a cart, toggle a setting or show an error message without duplicating screens.

  • Set variable: an interaction changes a value, such as incrementing a counter.
  • Conditionals: if and else branches choose actions based on variable values.
  • Expressions: arithmetic and string joining compute new values at runtime.
  • Mode switching: a prototype can change the mode of a frame, for example to preview dark mode.

Stateful prototypes reduce frame count dramatically, but they also introduce logic that must be tested. Complex conditions are hard to inspect, so teams should name variables clearly and document prototype logic next to the flow.

Common mistakes and how to avoid them

Most problems with Figma variables come from unclear naming and flat structures rather than from the feature itself. The table below lists typical symptoms, their causes and the usual fix.

SymptomLikely causeFix
Dark mode breaks on some screensLayers bound to primitives directlyRebind to semantic aliases
Pickers show hundreds of optionsMissing scopes and hidden primitivesApply scoping and hide raw values
Developers rename tokens manuallyNo code syntax definedSet code syntax per platform
Theme edits cause regressionsAliases mixed across collectionsDocument alias chains and review changes
Typical problems with variable systems

A final warning concerns library publishing. Changes to variables in a published library reach consumers only after they accept the update, so a renamed variable can leave files with detached or outdated values. Planned releases and change notes prevent most of these surprises.

Explained without jargon

Figma variables are saved settings with names. A designer might save a blue color as Brand primary or a spacing of 16 pixels as Medium gap. Every button and card then uses the name instead of the raw number.

When the team decides to change the blue, it changes one variable. Every screen updates at once. Variables can also hold two versions of the same setting, such as a light one and a dark one. Switching the whole design to dark mode then takes one click.

A typical use case

A product team at a mid-sized software company maintains a web application in two brands and two color schemes. The design system lead creates a Primitives collection with about 120 colors, a Semantic collection with light and dark modes, and a Brand collection with one mode per brand. Every component in the library binds only to semantic variables, and each variable carries web code syntax that matches the CSS custom properties used in production.

When marketing requests a new accent color for the second brand, the lead edits a single alias in the Brand collection and publishes the library. Designers accept the update, developers see the unchanged token names in Dev Mode, and an export script refreshes the JSON token file. The change reaches all four theme combinations in one afternoon instead of requiring a manual review of more than 300 screens.