Create an onboarding flow with advanced prototyping
This article is available for both the previous Figma UI and the new Figma UI. Use the toggle at the bottom left of the page to select your current UI. Get to know UI3: Figma’s redesign →
- Product: Figma design
- Topics: Variables, interactive components, prototypes, conditional logic, expressions, inline preview
- Difficulty: Advanced
- Length: 30 minutes
In this project, we’re going to build a prototype for a podcast app. In the onboarding flow, users select one or more topics of interest. The app then offers a collection of recommended podcasts that align with the user’s selected preferences.
Before continuing, you’ll need to duplicate the Figma Community file that contains the pre-built assets needed to complete this tutorial. By the end of the project, your final prototype will look similar to the following:
You can also watch our video tutorial to follow along.
We’re using variables, interactive components, and conditional logic to build our prototype.
These advanced features allow us to prototype with less time, reduce memory usage, and minimize maintenance time.
To build this prototype, we’ll do the following:
- Create boolean variables for topic buttons
- Track the number of topics selected
- Create enable conditions for the continue button
- Create disable conditions for the continue button
- Add a skip button
Let's begin!
Create boolean variables for topic buttons
The Community file contains a few of the key elements needed for our app, including:
- Get started page: where users can select one or more topics that interest them
- Homepage: which displays related podcast cards based on the users’ selections
- Loading page: which displays a loading animation
We also set up some initial prototyping connections. Users can select and unselect the topics on the get started page, and navigate across the pages.
The file also includes a component set named topic that represents the topic buttons. The component set includes a isSelected variant property, with a false value that represents the unselected state, and a true value that represents the selected state.
The Get started page includes four instances of the false variant that each represent a different topic: Music, Food & drink, Product design, and News.
Our goal is to remember which podcast topics were selected on the Get started page and display relevant podcast recommendations on the Homepage after the user taps Continue. To do this, we’ll use boolean variables.
Create the boolean variables
Let’s start by creating four boolean variables:
- With nothing selected, click Open variables in the Local variables section of the right sidebar.
- Click the + Create variable button and select Boolean.
- Rename the variable to “hasMusic”, and set the default value to “False”.
- Select the “hasMusic” variable and press Shift Enter to duplicate it.
- Rename the new variable to “hasFood” and set its value to “False”.
- Duplicate the variable again until you have four boolean variables named “hasMusic”, “hasFood”, “hasDesign”, and “hasNews”. All of them should have a default value of “False”.
Assign the boolean variables
Now, let’s close the panel and assign the variables to the topic instances on the get started page.
- Select the Music instance on the Get started page.
- Click Assign variable and assign the hasMusic variable.
- Repeat the steps and assign the hasFood variable to the Food & drinks instance, the hasDesign variable to the Product design instance, and the hasNews variable to the News instance.
Now that we have assign variables to all the instances, we also need to assign the variables to the podcast cards on the Homepage. This determines which podcast cards will be visible on the Homepage after the user selects their topic.
Think of it like a chain. The instance is linked to the boolean variable. We can then link the boolean variable to other elements in our design.
To apply the boolean variables to the podcast cards:
- Hold Shift and select all the music-related podcast cards on the homepage.
- From the right sidebar, right-click the eye in the Layer section to open the Assign variable panel.
- Select hasMusic variable.
- Repeat the steps to assign the hasFood variable to all the Food & drinks podcast cards, the hasDesign variable to all the Product design podcast cards, and the hasNews variable to all the News podcast cards.
Check your work
You’ll notice all the podcast cards are hidden on the homepage. This is because the default value of the variables are set to “False”, which turns the layer visibility of the cards to hidden. Before moving on, let’s check to make sure everything is behaving correctly.
- Press Shift Space to open inline preview.
- Select Music and Product design on the Get started page.
- Click Continue.
As you can see, only music and product design related cards are populated on the homepage. You should only see music and product design-related cards on the Homepage. If that isn’t the case, go back and make sure your variables are assigned correctly.
Track the number of topics selected
To prevent users from accessing the Homepage without choosing any topics, we’ll need to make sure that the Continue button is only enabled if at least one topic is selected.
We can do that using conditional logic and expressions. Let’s break it down:
- Every time we click on a topic, the number of selected topics will increase by 1
- If the number of selected topics is greater than 0, we will set the button from “disabled” to “enabled”
To achieve this, we will need two variables:
- A number variable, that will represent the number of selected topics
- And a string variable, that will represent the “disabled” or “enabled” state of the Continue button
Create the number variable
Let’s start by creating the number variable. We can do this directly in the Interaction details panel.
- Switch to the Prototype tab, and select the false variant in the topic component set.
- Click the current interaction from the right sidebar to open the interaction details panel.
- From the Add Actions dropdown menu, select Set variable.
- Click the plus in the pick target variable dropdown menu to open the variables panel.
- Select Number to create a number variable in the same variable collection.
- Name it
topicsSelected
and set its default value to0
. - Click Create variable.
Assign the number variable to the topic button
Let’s add the newly created variable to our interaction:
- Select the
topicsSelected
variable from the dropdown menu. - Enter
topicsSelected + 1
in the Value field. - Press Enter.
Create enable conditions for the continue button
The Set variable action has been added. Now, we need to think about our conditional. If the topicsSelected
amount is greater than 0, the Continue button’s state should change from “disabled” to “enabled”.
Let’s take a quick look at how our button component is set up. It has a variant property called “state”, with values for a “disabled” and “enabled” state.
We can use a string variable in our conditional statement with the same values.
Create the string variable
- With nothing selected on the canvas, click Open variables in the Local variables section of the right sidebar.
- Click + Create variable and select String.
- Rename the new variable to
buttonState
, and set its default value todisabled
.
Assign the string variable to the continue button
- Select the button instance on the get started page.
- Click Assign variable next to the state variant property in the right sidebar.
- Select
buttonState
variable.
Notice the button instance has changed from its enabled state to disabled state. That is because we have set the default value of the buttonState
variable to “disabled”. When we assigned the variable to the button instance, the variant property is linked to the variable’s default value and updated its state to match.
Add a conditional action to the topic button
Then, let’s add a conditional action to our topic component in order for our prototype to work.
- Navigate to the Prototype tab.
- Select the “False” variant in the topic component set.
- Click the prototype connection to open the Interaction details panel.
- From the Add action dropdown menu, select Check if/else.
- In the Condition field, enter
topicsSelected > 0
. - In the Add action field, select Set variable.
- Select
buttonState
from the dropdown menu. - Type
"enabled"
in the Value field. - Press Enter.
Check your work
Now that we have everything set up, let’s open inline preview and test it out.
By default, the Continue button is disabled until at least one topic is selected.
Create disable conditions for the continue button
We need to make sure that the Continue button reverts back to its disabled state if all topics are deselected. We can do that by adding additional actions to the topic component set.
Just like before, we can do that by adding actions to the topic component set. But this time, we’ll add the actions to the reversed direction.
Let’s break down the interactions we need to add:
- Every time we deselect a topic, the number of selected topics will decrease by 1
- If the number of selected topics is less than 1, we will set the button back to “disabled”
To add the new Set variable action to the True variant:
- Switch to Prototype tab.
- Select the “True” variant in the topic component set.
- Click the prototype connection to open the interaction details panel.
- From the Add actions dropdown menu, select Set variable.
- Select
topicsSelected
from the pick target variable dropdown menu. - Enter
topicsSelected - 1
in the Value field. - Press Enter.
Then, we’ll add a new conditional action to the variant:
- From the Add Actions dropdown menu, select Check if/else.
- Enter
topicsSelected < 1
in the Value field. - Click to open the Add action field and select Set variable.
- Select
buttonState
from the dropdown menu. - Type
"disabled"
in the Value field. - Press Enter to confirm.
Check your work
Open the inline preview and test the interaction. When we select a topic, the Continue button becomes enabled. When we deselect the topic, the Continue button reverts to its disabled state.
Add a skip button
We can add a Skip button to the Get started page so users can opt out of the onboarding process. The Community file already includes a Skip button design in the Button component set, so let’s add the enabled variant to our design.
- While holding ⌥ Option (Mac) or Alt (Windows), click and drag the “secondary, enabled” button variant to create an instance.
- Place the instance below the Continue button inside the get started page.
- Hold Shift to select both buttons, and press Shift A to add auto layout.
- Set vertical gap between items to
16
. - Align the new auto layout frame to the center of the Get started page.
Add a prototype connection
We need to add a prototype connection so that when a user clicks the Skip button, they are brought to the Loading page. The Loading page has its own interaction to automatically navigate to the homepage after a delay.
- Switch to Prototype tab.
- Select the Skip button on the get started page.
- Click the blue plus sign on the edge of the button, and drag the connection to the loading page. This opens up the Interaction details modal.
Because the user is skipping the onboarding step, we’ll need to add an action to the Skip button to set the hasMusic, hasFood, hasDesign, and hasNews variables to true. This will cause all podcast cards to display on the Homepage if the Skip button is tapped.
- From the Add Actions dropdown menu, select Set variable.
- Select hasMusic from the Pick target variable dropdown menu.
- Select True from the Write expression dropdown menu.
- Repeat the steps to add new set variable actions until you have set hasFood, hasDesign, and hasNews to
true
.
Check your work
Let’s test it out again in inline preview.
When we select the skip button, all the cards show up on the home screen.
What's next?
Congratulations! You’ve created a prototype with advanced prototyping features. If you want to challenge yourself a bit more, try creating a prototype where users are only allowed to select two or less options with conditional logic.
If you’re interested to learn how to create the podcast card design or the loading animation, check out the following mini projects:
- Product: Figma design
- Topics: Variables, interactive components, prototypes, conditional logic, expressions, inline preview
- Difficulty: Advanced
- Length: 30 minutes
In this project, we’re going to build a prototype for a podcast app. In the onboarding flow, users select one or more topics of interest. The app then offers a collection of recommended podcasts that align with the user’s selected preferences.
Before continuing, you’ll need to duplicate the Figma Community file that contains the pre-built assets needed to complete this tutorial. By the end of the project, your final prototype will look similar to the following:
You can also watch our video tutorial to follow along.
We’re using variables, interactive components, and conditional logic to build our prototype.
These advanced features allow us to prototype with less time, reduce memory usage, and minimize maintenance time.
To build this prototype, we’ll do the following:
- Create boolean variables for topic buttons
- Track the number of topics selected
- Create enable conditions for the continue button
- Create disable conditions for the continue button
- Add a skip button
Let's begin!
Create boolean variables for topic buttons
The Community file contains a few of the key elements needed for our app, including:
- Get started page: where users can select one or more topics that interest them
- Homepage: which displays related podcast cards based on the users’ selections
- Loading page: which displays a loading animation
We also set up some initial prototyping connections. Users can select and unselect the topics on the get started page, and navigate across the pages.
The file also includes a component set named topic that represents the topic buttons. The component set includes a isSelected variant property, with a false value that represents the unselected state, and a true value that represents the selected state.
The Get started page includes four instances of the false variant that each represent a different topic: Music, Food & drink, Product design, and News.
Our goal is to remember which podcast topics were selected on the Get started page and display relevant podcast recommendations on the Homepage after the user taps Continue. To do this, we’ll use boolean variables.
Create the boolean variables
Let’s start by creating four boolean variables:
- With nothing selected, click Open variables in the Local variables section of the right sidebar.
- Click the + Create variable button and select Boolean.
- Rename the variable to “hasMusic”, and set the default value to “False”.
- Select the “hasMusic” variable and press Shift Enter to duplicate it.
- Rename the new variable to “hasFood” and set its value to “False”.
- Duplicate the variable again until you have four boolean variables named “hasMusic”, “hasFood”, “hasDesign”, and “hasNews”. All of them should have a default value of “False”.
Assign the boolean variables
Now, let’s close the panel and assign the variables to the topic instances on the get started page.
- Select the Music instance on the Get started page.
- Click Assign variable and assign the hasMusic variable.
- Repeat the steps and assign the hasFood variable to the Food & drinks instance, the hasDesign variable to the Product design instance, and the hasNews variable to the News instance.
Now that we have assign variables to all the instances, we also need to assign the variables to the podcast cards on the Homepage. This determines which podcast cards will be visible on the Homepage after the user selects their topic.
Think of it like a chain. The instance is linked to the boolean variable. We can then link the boolean variable to other elements in our design.
To apply the boolean variables to the podcast cards:
- Hold Shift and select all the music-related podcast cards on the homepage.
- From the right sidebar, right-click the eye in the Layer section to open the Assign variable panel.
- Select hasMusic variable.
- Repeat the steps to assign the hasFood variable to all the Food & drinks podcast cards, the hasDesign variable to all the Product design podcast cards, and the hasNews variable to all the News podcast cards.
Check your work
You’ll notice all the podcast cards are hidden on the homepage. This is because the default value of the variables are set to “False”, which turns the layer visibility of the cards to hidden. Before moving on, let’s check to make sure everything is behaving correctly.
- Press Shift Space to open inline preview.
- Select Music and Product design on the Get started page.
- Click Continue.
As you can see, only music and product design related cards are populated on the homepage. You should only see music and product design-related cards on the Homepage. If that isn’t the case, go back and make sure your variables are assigned correctly.
Track the number of topics selected
To prevent users from accessing the Homepage without choosing any topics, we’ll need to make sure that the Continue button is only enabled if at least one topic is selected.
We can do that using conditional logic and expressions. Let’s break it down:
- Every time we click on a topic, the number of selected topics will increase by 1
- If the number of selected topics is greater than 0, we will set the button from “disabled” to “enabled”
To achieve this, we will need two variables:
- A number variable, that will represent the number of selected topics
- And a string variable, that will represent the “disabled” or “enabled” state of the Continue button
Create the number variable
Let’s start by creating the number variable. We can do this directly in the Interaction details panel.
- Switch to the Prototype tab, and select the false variant in the topic component set.
- Click the current interaction from the right sidebar to open the interaction details panel.
- From the Add Actions dropdown menu, select Set variable.
- Click the plus in the pick target variable dropdown menu to open the variables panel.
- Select Number to create a number variable in the same variable collection.
- Name it
topicsSelected
and set its default value to0
. - Click Create variable.
Assign the number variable to the topic button
Let’s add the newly created variable to our interaction:
- Select the
topicsSelected
variable from the dropdown menu. - Enter
topicsSelected + 1
in the Write expression field. - Press Enter.
Create enable conditions for the continue button
The Set variable action has been added. Now, we need to think about our conditional. If the topicsSelected
amount is greater than 0, the Continue button’s state should change from “disabled” to “enabled”.
Let’s take a quick look at how our button component is set up. It has a variant property called “state”, with values for a “disabled” and “enabled” state.
We can use a string variable in our conditional statement with the same values.
Create the string variable
- With nothing selected on the canvas, click Open variables in the Local variables section of the right sidebar.
- Click + Create variable and select String.
- Rename the new variable to
buttonState
, and set its default value todisabled
.
Assign the string variable to the continue button
- Select the button instance on the get started page.
- Click Assign variable next to the state variant property in the right sidebar.
- Select
buttonState
variable.
Notice the button instance has changed from its enabled state to disabled state. That is because we have set the default value of the buttonState
variable to “disabled”. When we assigned the variable to the button instance, the variant property is linked to the variable’s default value and updated its state to match.
Add a conditional action to the topic button
Then, let’s add a conditional action to our topic component in order for our prototype to work.
- Navigate to the Prototype tab.
- Select the “False” variant in the topic component set.
- Click the prototype connection to open the Interaction details panel.
- From the Add action dropdown menu, select Conditional.
- In the Write condition field, enter
topicsSelected > 0
. - In the Add action field, select Set variable.
- Select
buttonState
from the dropdown menu. - Type
"enabled"
in the Write expression field. - Press Enter.
Check your work
Now that we have everything set up, let’s open inline preview and test it out.
By default, the Continue button is disabled until at least one topic is selected.
Create disable conditions for the continue button
We need to make sure that the Continue button reverts back to its disabled state if all topics are deselected. We can do that by adding additional actions to the topic component set.
Just like before, we can do that by adding actions to the topic component set. But this time, we’ll add the actions to the reversed direction.
Let’s break down the interactions we need to add:
- Every time we deselect a topic, the number of selected topics will decrease by 1
- If the number of selected topics is less than 1, we will set the button back to “disabled”
To add the new Set variable action to the True variant:
- Switch to Prototype tab.
- Select the “True” variant in the topic component set.
- Click the prototype connection to open the interaction details panel.
- From the Add actions dropdown menu, select Set variable.
- Select
topicsSelected
from the pick target variable dropdown menu. - Enter
topicsSelected - 1
in the Write expression field. - Press Enter.
Then, we’ll add a new conditional action to the variant:
- From the Add Actions dropdown menu, select Conditional.
- Enter
topicsSelected < 1
in the Write condition field. - Click to open the Add action field and select Set variable.
- Select
buttonState
from the dropdown menu. - Type
"disabled"
in the Write expression field. - Press Enter to confirm.
Check your work
Open the inline preview and test the interaction. When we select a topic, the Continue button becomes enabled. When we deselect the topic, the Continue button reverts to its disabled state.
Add a skip button
We can add a Skip button to the Get started page so users can opt out of the onboarding process. The Community file already includes a Skip button design in the Button component set, so let’s add the enabled variant to our design.
- While holding ⌥ Option (Mac) or Alt (Windows), click and drag the “secondary, enabled” button variant to create an instance.
- Place the instance below the Continue button inside the get started page.
- Hold Shift to select both buttons, and press Shift A to add auto layout.
- Set vertical gap between items to
16
. - Align the new auto layout frame to the center of the Get started page.
Add a prototype connection
We need to add a prototype connection so that when a user clicks the Skip button, they are brought to the Loading page. The Loading page has its own interaction to automatically navigate to the homepage after a delay.
- Switch to Prototype tab.
- Select the Skip button on the get started page.
- Click the blue plus sign on the edge of the button, and drag the connection to the loading page. This opens up the Interaction details modal.
Because the user is skipping the onboarding step, we’ll need to add an action to the Skip button to set the hasMusic, hasFood, hasDesign, and hasNews variables to true. This will cause all podcast cards to display on the Homepage if the Skip button is tapped.
- From the Add Actions dropdown menu, select Set variable.
- Select hasMusic from the Pick target variable dropdown menu.
- Select True from the Write expression dropdown menu.
- Repeat the steps to add new set variable actions until you have set hasFood, hasDesign, and hasNews to
true
.
Check your work
Let’s test it out again in inline preview.
When we select the skip button, all the cards show up on the home screen.
What's next?
Congratulations! You’ve created a prototype with advanced prototyping features. If you want to challenge yourself a bit more, try creating a prototype where users are only allowed to select two or less options with conditional logic.
If you’re interested to learn how to create the podcast card design or the loading animation, check out the following mini projects: