If you're like me, you were a bit overwhelmed the first time you started prototyping with variables ๐ฌ
But once you master it you start to realize something...
It follows the same repeatable steps ๐
My goal with figma.academy is to simplify prototyping with variables as much as I possibly can...
So here's how I break it down into 4 repeatable steps ๐
01 // Create the variable you need
Start by asking yourself "What piece of UI do I want to change in my prototype?"
You'll need a variable for that ๐ก
Here's how you pick the right variable type for the job ๐
01 //
Which type you choose depends on what you're trying to accomplish ๐
๐ค Are you updating text?
โคท string/number
๐งฑ Are you updating components?
โคท string/boolean
๐ Are you changing visibility?
โคท boolean
๐จ Are you updating styling?
โคท color/number
01 //
Once you have the variables created, use that first column to define your DEFAULT value.
Note: if you're using string variables to control component states then you're going to want to write the name of your starting variant exactly as it appears ๐
02 // Assign your variable to your UI
You're going to hear the word "bind" a lot... all that means is that you're mapping a variable to a piece of UI
You'll always bind variables in the relevant section of the properties panel ๐
03 // Test your connection
Before jumping into prototyping mode I like to run a test to make sure things are behaving the way I expect.
Open up your local variables and make a change to the default value...
Did it update your UI? If yes, then you're ready for step 4 ๐
04 // Set up your triggers
This is where it starts to get fun ๐คฉ
There's WAY too much for a thread. I have a whole module of videos in figma.academy on this topic...
But I do want to leave you with one idea that hopefully simplifies this whole feature set for you ๐
04 //
Every variable-powered prototype you make will end with a `Set Variable` interaction.
That's ultimately the goal... to use variables to trigger a change in your UI by updating the variable you've assigned.
Here's the question you have to ask yourself though ๐
04 //
"Do I have to first see if a separate condition is met before I can change this UI?" ๐ค
If no โ `Set Variable`
If yes โ Add a `Conditional` first and THEN nest your `Set Variable`
Thinking of `Conditional` as a wrapper for `Set Variable` was a huge unlock for me ๐
Before you go...
You're going to want to add variables to ALL of your prototypes...
Don't do that ๐ฌ
Variables are great when used strategically but they can also add a lot of unnecessary complexity too
You'll have to follow @ridd_design for a future thread on that though :)