Open In App

Variables in Figma

Last Updated : 21 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

What are Variables in Figma?

Variables allow you to save reusable values that can be applied to different kinds of design properties like stroke, padding, margin, etc.

For example: you might have a button design with a specific color and text style instead of manually adjusting each of these properties every time you create a new button you can use variables to store these values and update them consistently across your file.

You might think that this is the definition of styles NOT REALLY, although both styles and variables allow you to store re-usable values they have some fundamental differences.

Variables

Styles

a variable can store individual raw values like hex color code or a string of text.

a style can be used for properties that are made of multiple values such as gradients or shadow.

a variable can reference another variable or even a style.

a style can’t reference another style.

Variables allows you to create dynamic relationships between elements. you can use variables to manage things like layout ,spacing, alignment, proportions and also animations.

Types of Variables in Figma

There are four types of variables in Figma : number, string, boolean, color.

1. Number:

Number variables assign numerical values to variables, and you can apply them to various properties like text layers, corner radius, minimum and maximum widths or heights and spacing values. This type of variable is handy when you want to control sizes, spacing or other numerical attributes to your design.

2. String:

String variables involve creating specific strings of characters, which can be applied to any text layer, including nested instances within components. Use string variables to manage and apply consistent text content or labels across your design. This is helpful for maintaining uniformity in text elements.

3. Boolean:

Boolean variables use true or false values. they control layer visibility, allowing you to show or hide elements based on conditions. Boolean variables deal with true or false values. They are used to control the visibility of layers, allowing you to decide whether an image or container is displayed based on conditions like the device size (desktop or mobile).

4. Color:

Color variables allow you to define a specific color that can be applied to elements, either filling the inside or outlining the edges. You can use color variables to maintain consistency in your design by easily changing the color across multiple elements at once.

How to Create Variables in Figma?

Number Variables:

  • To change the size or spacing or something, find the number box.
  • look for a little icon on the right side of that box.
  • click it, and you’ll see a list of options(like different sizes)
  • pick the one you want by clicking or using the arrow keys.
  • The chosen size(for example, 6 pixels) shows up as a gray box, making it clear what you’ve picked. That’s it!
Create Variable Number

Create a variable number

Dimensions and corner Radius

Define the dimensions and corner radius

String Variables:

  • if you want to change the words or text in your text in your design, select the text layer.
  • look for the variables icon in the text section of the design panel.
  • clicking on it lets you choose between a string (which is like words or text ) or a number variable.
  • this is helpful because you might want to use both words and numbers in your design.
  • pick the one you need, and you’re good to go!
Create a variable string

Create a variable string

setting the values

Add the text and set your values

Adding the interaction

Add the interaction (in this when you click on that button it shows the value added)

Boolean Variables:

  • If you want show or hide something, right-click on the layer and toggle the visible/hidden options.
  • You’ll see a list of choices (boolean variables) to control whether it’s visible or not.
  • If you’re working with different versions of something(like light or dark mode), go near the settings and use the variable icon to pick the right version.
  • just remember, you can only link these choices to specific versions of a component, not the main one.
boolean variable creation

Create a variable boolean

naming the variable

Name your variable and change the value to true(you can change the value to true or false it depends on situation)

alert

Click on the alert

adding interaction

Add the interaction

Color Variables:

  • Changing colors in Figma is like picking up a style.
  • Click on the thing you want to color.
  • Find the four-dot icon in the color settings.
  • Colors and styles are there- squares means colors, circles means styles.
  • Just a quick heads up , for now color variables don’t handle special effects like shadows or blurs. if your design uses a lot of those, it might be better to wait a bit!
color variable creation

Create a variable color

applying values to fill

Now you can apply color values to fill colors , stroke color etc.

Properties of Variables in Figma

1. Text Styles:

  • Properties: how text looks- fonts, size, color etc.
  • Functionality: create a style for your text, so it looks the same every where.

2. Color Styles:

  • Properties: colors for your design.
  • Functionality: pick and reuse colors easily across yours project.

3. Components:

  • Properties: Different aspects like size, position and style.
  • Functionality: Create reusable design elements. change one, and it automatically updates all copies.

4. Auto Layout:

  • Properties: How things are spaced and aligned.
  • Functionality: Helps keep things organised and consistent when you change your design.

5. Constraints:

  • Properties: How objects behave when things around them change.
  • Functionality: Keeps your design flexible and looking good on different screens.

Importance of Variables in Figma

  • Variables help make sure everything looks the same in your design. When you change a variable it changes all the things that use it, so you don’t have to fix each one separately.
  • Instead of doing the same thing over and over, like changing the color size you change the variable once and it does the job everywhere .
  • With variables you can quickly try out different styles or designs. change a variable it updates all over your design.
  • Variables help avoid mistakes. If you change something, you only need to fix it in one place, so you’re less likely to mess things up.
  • When you’re designing for different devices (like phones or computers etc), variables make sure your design looks good on all of them. They help things adapt.
  • Think of variables like labels. They keep everything organized and make it easy for everyone to understand and work together.

Conclusion

The introduction of variables in Figma has brought joy to designers significantly boosting speed and efficiency .They help designers keep a consistent look in all their designs without doing a lot of manual work . The ability to effortlessly switch themes, sizes or languages with just a few clicks, especially when toggling between light and dark modes, feels like magic compared to pervious manual processes. The benefits outweigh the challenges and designers are encouraged to explore and implement variables in their work , leading in a new era of creativity and collaboration in Figma.



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads