🚧 Variables is currently in open beta. We’ll continue to add more features and polish the experience during this time. Find out what’s coming next →
Variables store values—like fill colors, padding, visibility, and more—that can be reused throughout designs.
Like styles and components, variables can also be published to team libraries. When you update the value of a variable, you can update designs across files accordingly. This helps to create consistent designs across projects and makes updating design systems more efficient.
Types of variables
There are four types of variables. Each one can be applied to specific properties and elements.
|Can be applied to
Text strings and variant names
A variable’s definition can be aliased, or reference another variable’s definition, making it possible to implement design tokens. Any variable can be aliased to an existing variable of the same type. For example, color variables can only reference other color variables. Learn how to alias variables →
Note: You can create up to 5,000 variables per collection.
Collections and groups
Both collections and groups are used to organize variables and make them easier to find.
A collection is a set of variables and modes. Collections can be used to organize related variables together. For example, use one collection to localize text in different languages, and another collection for spatial values.
You can further organize variables by adding them to groups within a collection. For example, use one group for colors used for text, and another for colors used on strokes.
A mode is a list of values for a variable in a collection, storing one value per variable. Modes also represent the different contexts of our designs.
If a variable has multiple definitions, each definition is associated with a mode. When the variable is applied to a layer's property, the layer expresses the value based on the mode it's currently in, allowing us to quickly switch our designs between contexts.
For example, we might have a color variable storing two color values: a blue color under one mode, and a white color under a different mode. We apply this variable to a text layer, which will either appear as blue or white depending on the mode it’s in.
Here are a few ways you can use modes to switch contexts:
- Different color themes, like light and dark modes
- Different languages to see how copy flows in designs
- Devices sizes to see how elements look with different spacing and padding
Styles and variables
Both variables and styles can store color values, are used as a source of truth, and be reused throughout designs for efficiency and consistency.
When deciding whether to use a variable or style, keep in mind:
A style can be used for properties that are made up of multiple values, such as gradients or shadows. Although styles cannot reference other styles, they can reference variables.
Variables are made up of individual raw values, such as
#E5E5E5 in one mode and
#888888 in another. The ability to switch between contexts can only be done using modes for variables. In addition, variables can be aliased to create complex design token structures.
Copy pasting variables across files
Variables can be used in prototypes.
Currently, if you copy and paste objects to different file, the prototype will continue to work as the variables transfer over. However, any unpublished variables applied to prototypes won’t be available for further use, like when creating Set variable actions, or switching an object’s number variable.
We are working on improving transferring variables across files. As a workaround, either recreate the variables in the destination file, or duplicate the original file.
If the original file is published to team libraries, copied and pasted variables will work as expected.
If you receive a notification that pasting unpublished variables across files won’t create new local variables yet, try publishing the source library and and enabling it in the destination file.
Ready to continue your variables journey? Learn how to create and manage variables →