My Resume
  • Variables

A practical guide to Figma variables

How collections, modes and aliases work in Figma variables, and how to set them up for light and dark themes.

Article details

Published
5 July 2023
Reading time
2 min read
Topics
Variables

Variables brought design tokens into Figma itself. Used well, they let one file handle themes, brands and screen sizes without duplicating a single frame.

01The four building blocks

  • Variable: a named value. It can be a colour, a number, a string or a boolean.
  • Collection: a group of related variables, such as Primitives or Semantic colours.
  • Mode: a set of values for the same variables, such as Light and Dark.
  • Alias: a variable that points to another variable instead of holding a raw value.

02A setup that scales

  1. Create a Primitives collection with your raw palette, spacing and radii. One mode is enough.
  2. Create a Semantic collection with Light and Dark modes. Alias every value to a primitive.
  3. Bind components to semantic variables only, never to primitives.
  4. Switch the mode on a frame and every component inside it follows.

03Beyond colour

Number variables work for spacing, radii and sizes, so a Compact and a Comfortable mode can share the same components. String variables are useful for prototyping copy in two languages, which helps a lot when designing Arabic and English side by side.

04Common mistakes

  • Binding components straight to primitives, which breaks theming later.
  • Creating a mode for every small exception instead of a new semantic variable.
  • Naming variables after where they’re used today instead of what they mean.
Written byMohamed Abo SolimanLead Product Designer · Design Systems
ShareinX
Next articleThink like a programmer with variables

Available for select projects

Building a design system?

I help teams set up design systems and DesignOps that people actually adopt.