Boolean Variables in Figma
Boolean Variables in Figma are variables that store only two possible values: true or false. They are mainly used to control on/off states, layer visibility, component variants, and interactive prototype states. Boolean variables make designs more flexible because a single variable can represent whether a particular feature, element, or state is enabled or disabled.
For professional Figma learning, explore JustAcademy Figma Training and Register for Figma Course Demo.
1. What is a Boolean Variable?
A Boolean Variable is a Figma variable whose value can be either true or false. Unlike Color, Number, or String variables, a Boolean Variable represents a binary state.
For example, an interface may need to know whether a notification badge should be visible. Instead of manually changing the visibility every time, we can create a Boolean Variable such as showNotification.
showNotification = true
showNotification = false
When the value is true, the related layer can be visible. When the value is false, the related layer can be hidden.
2. Boolean Values: True and False
Boolean variables support only two logical values:
| Value | Meaning | Example |
| true | Enabled, active, visible, selected, or available | showIcon = true |
| false | Disabled, inactive, hidden, unselected, or unavailable | showIcon = false |
A Boolean Variable should be used whenever the design logic naturally has two possible states.
3. Why Use Boolean Variables?
Boolean Variables reduce repetitive manual changes and make designs easier to manage. They are especially useful when a design contains many components or interactive states.
- Control layer visibility.
- Create reusable on/off states.
- Control component variant properties.
- Create interactive prototypes.
- Represent selected and unselected states.
- Represent enabled and disabled states.
- Manage optional UI elements.
- Support conditional prototype logic.
- Make complex prototypes easier to maintain.
- Keep design systems more consistent.
4. Boolean Variable vs Boolean Property
Boolean Variables and Boolean Component Properties both use true/false values, but they serve different purposes.
| Feature | Boolean Variable | Boolean Property |
| Purpose | Stores a reusable true/false value | Controls a component property |
| Values | true / false | true / false |
| Layer Visibility | Yes | Yes |
| Component Variants | Can be mapped to true/false variant properties | Can control component behavior |
| Prototype Logic | Yes | Not primarily a variable storage mechanism |
| Reusable Across Designs | Yes | Usually associated with a component |
In simple terms, a Boolean Variable stores the state, while a Boolean Property exposes a component-level true/false control.
5. Examples of Boolean Variables
Common Boolean Variable names can describe whether a feature or state is enabled.
isLoggedIn = true
isDarkMode = false
showNotification = true
showBadge = false
isSelected = true
isDisabled = false
showIcon = true
hasError = false
isExpanded = true
isLoading = false
Good Boolean names normally communicate a condition or state clearly.
6. Creating a Boolean Variable in Figma
Boolean Variables can be created from Figma's Variables view.
- Open your Figma Design file.
- Open the Variables view from the left navigation.
- Select an existing variable collection or create a collection.
- Click Create variable.
- Select Boolean as the variable type.
- Enter a meaningful variable name.
- Set the initial value to true or false.
- Use the variable in supported design properties or prototype interactions.
Collection: Component States
Variable: showBadge
Type: Boolean
Default Value: true
7. Boolean Variable Structure
A Boolean Variable can be understood using four basic parts: collection, name, type, and value.
Variable Collection
|
+-- Component States
|
+-- showBadge
| Type: Boolean
| Value: true
|
+-- isDisabled
Type: Boolean
Value: false
8. Naming Boolean Variables
Good naming is important because Boolean Variables are frequently used in design systems and prototypes.
Use names that clearly describe the state or condition.
| Good Name | Reason |
| showIcon | Clearly indicates visibility |
| isDisabled | Clearly indicates a state |
| isSelected | Clearly represents selection |
| hasError | Clearly represents an error condition |
| showBadge | Clearly represents badge visibility |
Avoid unclear names such as value1, flag, test, or boolean2.
9. Boolean Variables for Layer Visibility
One of the most useful applications of Boolean Variables is controlling layer visibility.
For example, suppose a card contains a promotional badge. Instead of manually showing and hiding the badge, create a Boolean Variable called showBadge.
showBadge = true
↓
Badge Visible
showBadge = false
↓
Badge Hidden
Figma supports applying Boolean Variables to layer visibility. When the variable is true, the layer is visible; when false, the layer is hidden.
10. Applying a Boolean Variable to Layer Visibility
- Select the layer whose visibility you want to control.
- Go to the Appearance section in the right sidebar.
- Find the visible/hidden control.
- Open the variable picker.
- Select the Boolean Variable.
- Change the variable value between true and false to test the result.
showNotification = true
↓
Notification Layer → Visible
showNotification = false
↓
Notification Layer → Hidden
11. Boolean Variables and Component Variants
Boolean Variables can also be mapped to component variant properties that have true and false values. This makes it possible to switch component variants based on a Boolean state.
For example, create a button component with two variants:
Button
├── hasIcon = true
└── hasIcon = false
A Boolean Variable such as hasIcon can then determine which variant should be used.
12. Boolean Variable with a Button Component
Consider a button that can have an optional icon.
Variable:
showIcon = true
Component:
Button
├── showIcon = true
│ → Icon Visible
└── showIcon = false
→ Icon Hidden
This approach allows the component to respond to a reusable Boolean state instead of requiring multiple unrelated controls.
13. Boolean Variables for Selected States
Boolean Variables are useful for representing whether an item is selected.
isSelected = true
→ Selected State
isSelected = false
→ Unselected State
This can be useful for cards, tabs, filters, checkboxes, navigation items, onboarding options, and other interactive UI elements.
14. Boolean Variables for Disabled States
A Boolean Variable can represent whether an interface element is disabled.
isDisabled = true
→ Disabled Button
isDisabled = false
→ Active Button
For a design system, variables such as isDisabled can help model reusable component states.
15. Boolean Variables for Notifications
Notification badges are another practical example.
hasNotification = true
→ Display notification badge
hasNotification = false
→ Hide notification badge
This is particularly useful when designing dashboard interfaces, messaging applications, social media interfaces, and e-commerce applications.
16. Boolean Variables for Error States
Boolean Variables can represent whether a component is currently in an error state.
hasError = true
→ Show error message
hasError = false
→ Hide error message
For example, a form field can contain an error message layer that becomes visible when hasError is true.
17. Boolean Variables for Loading States
Boolean Variables can also represent loading conditions.
isLoading = true
→ Show loading indicator
isLoading = false
→ Show normal content
This is useful when creating prototypes for login screens, dashboards, checkout processes, search results, and data-loading interfaces.
18. Boolean Variables and Modes
Boolean Variables can have different values across variable modes. Modes allow a collection to store different values for different design contexts.
Collection: UI States
Mode: Default
showBadge = true
Mode: Alternate
showBadge = false
Modes can be useful when the same variable needs to represent different contexts without creating separate variables for each context.
19. Boolean Variables in Light and Dark Designs
Boolean Variables are not limited to colors. They can represent whether a particular UI element should appear in a specific context.
Light Mode:
showDecorativeIllustration = true
Dark Mode:
showDecorativeIllustration = false
This can be useful when a decorative element is appropriate in one design context but should be hidden in another.
20. Boolean Variables in Responsive Designs
Boolean Variables can also represent whether an element should be available in a particular responsive context.
Desktop:
showSidebar = true
Mobile:
showSidebar = false
This concept can help communicate responsive behavior in a design system or prototype, although responsive layout behavior should still be designed using appropriate layout and component techniques.
21. Boolean Variables in Localization
Boolean Variables can help control optional interface elements when different localized versions of a design require different content structures.
showSecondaryLabel = true
showSecondaryLabel = false
For example, a design may show an additional label in one context and hide it in another when the available space is limited.
22. Boolean Variables in Prototyping
Boolean Variables are especially powerful in Figma prototypes because interactions can update variable values. Figma's Set variable action can assign true or false to Boolean Variables.
User clicks Toggle
↓
Set variable
↓
isDarkMode = true
↓
Dark state appears
This allows designers to build interactive experiences without creating a separate frame for every state.
23. Boolean Variable with Set Variable Action
A prototype can use the Set variable action to change a Boolean Variable.
- Create a Boolean Variable.
- Create an interactive element such as a button or toggle.
- Add a prototype interaction.
- Select Set variable.
- Select the Boolean Variable.
- Set the new value to true or false.
- Preview the prototype.
Trigger: Click
Action: Set variable
Variable: isActive
New Value: true
24. Example: Dark Mode Toggle
A dark mode prototype can use a Boolean Variable to represent whether dark mode is enabled.
Variable:
isDarkMode
Initial Value:
false
User clicks Dark Mode Toggle
↓
Set variable
↓
isDarkMode = true
↓
Dark Mode Active
When the user interacts with the toggle again, the variable can be changed back to false.
25. Example: Show and Hide Password
A password field can use a Boolean state to represent whether the password visibility option is active.
showPassword = false
↓
Password appears hidden
showPassword = true
↓
Password appears visible
This is a useful example for demonstrating Boolean logic in an interactive prototype.
26. Example: Expand and Collapse Menu
A Boolean Variable can represent whether a navigation menu is expanded.
isExpanded = false
↓
Collapsed Menu
isExpanded = true
↓
Expanded Menu
This can be used for sidebar navigation, accordion sections, dropdown menus, and mobile navigation prototypes.
27. Example: E-Commerce Wishlist
In an e-commerce interface, a Boolean Variable can represent whether a product is added to a wishlist.
isWishlisted = false
↓
♡ Add to Wishlist
isWishlisted = true
↓
♥ Added to Wishlist
The variable can be updated through a prototype interaction.
28. Example: Notification Badge
A dashboard notification icon can use a Boolean Variable to control its badge.
hasUnreadNotification = true
↓
Show Badge
hasUnreadNotification = false
↓
Hide Badge
This provides a simple way to demonstrate conditional visibility in a prototype.
29. Example: Form Validation
Boolean Variables can represent validation conditions in prototypes.
hasError = false
↓
Normal Input
hasError = true
↓
Show Error Message
Show Error Styling
For more advanced prototypes, Boolean Variables can be combined with expressions and conditional logic to create more realistic flows.
30. Boolean Variables with Expressions
Figma prototypes can use variables with expressions and conditional logic. Boolean values can participate in logical checks such as whether a condition is true or false.
isLoggedIn = true
IF isLoggedIn
→ Show Dashboard
ELSE
→ Show Login Screen
This makes Boolean Variables useful for creating state-driven prototypes.
31. Boolean Variables and Conditional Logic
Conditional logic can be used to evaluate Boolean states.
IF isSelected = true
→ Show Selected State
ELSE
→ Show Default State
This approach is useful for onboarding flows, quizzes, filters, forms, dashboards, and other interactive experiences.
32. Boolean Variables in Design Systems
Boolean Variables can become part of a larger design-system architecture. A collection can contain reusable variables representing component states.
Component States
├── isDisabled
├── isSelected
├── isLoading
├── showIcon
├── showBadge
└── hasError
Organizing Boolean Variables in a dedicated collection can make large design systems easier to understand and maintain.
33. Boolean Variables and Variable Collections
Boolean Variables are stored inside variable collections. A collection can group related variables together based on their purpose.
Variable Collection: Component States
├── isDisabled
├── isSelected
├── isLoading
├── showIcon
└── hasError
This creates a logical structure for managing component-related states.
34. Boolean Variables vs Number Variables
| Feature | Boolean | Number |
| Values | true / false | Numeric values |
| Example | isDisabled = false | spacing = 16 |
| Main Use | Binary states | Sizes, spacing, dimensions |
| Visibility | Yes | No |
| Logical State | Excellent | Not primarily intended |
35. Boolean Variables vs String Variables
| Feature | Boolean | String |
| Value | true / false | Text |
| Example | isActive = true | buttonText = "Submit" |
| Main Purpose | Binary state | Text content or string-based values |
| Visibility Control | Yes | Not primarily |
36. Boolean Variables vs Component Variants
Component variants represent different versions of a component, while Boolean Variables can provide reusable true/false values that can be mapped to appropriate variant properties.
Boolean Variable
↓
isSelected = true
↓
Component Variant
↓
Selected State
This combination is particularly useful for interactive components and design systems.
37. Practical Project: Toggle Component
Create a toggle component using a Boolean Variable.
Step 1: Create the Variable
Name: isOn
Type: Boolean
Value: false
Step 2: Create the Component
Create two visual states representing the toggle's off and on conditions.
Toggle
├── isOn = false
│ → Off
└── isOn = true
→ On
Step 3: Add Interaction
Add an interaction that changes the value of isOn.
On Click
↓
Set variable
↓
isOn = true / false
Step 4: Test the Prototype
Run the prototype and click the toggle. The Boolean Variable should change state and the related component behavior should update.
38. Practical Project: Notification Toggle
Create a notification settings prototype.
Variable:
notificationsEnabled = true
ON:
Notifications Enabled
OFF:
Notifications Disabled
Use a toggle component and Set variable interaction to switch the value.
39. Practical Project: Mobile Navigation
Create a mobile navigation menu controlled by a Boolean Variable.
Variable:
isMenuOpen = false
false → Menu Closed
true → Menu Open
When the hamburger icon is clicked, update the Boolean Variable and change the menu state.
40. Practical Project: E-Commerce Product Card
Create a product card containing an optional discount badge, wishlist icon, and availability state.
Variables:
showDiscount = true
isWishlisted = false
isAvailable = true
These states can control different visual elements of the product card.
41. Practical Project: Login Flow
Create a login prototype using Boolean Variables.
Variables:
isLoggedIn = false
hasError = false
isLoading = false
Login Click
↓
isLoading = true
↓
Validation
↓
IF successful
→ isLoggedIn = true
→ isLoading = false
ELSE
→ hasError = true
→ isLoading = false
This example demonstrates how multiple Boolean Variables can represent different application states.
42. Boolean Variables in Dev Mode
When developers inspect designs in Dev Mode, they can encounter Boolean Variables along with other variable types. Variable details can provide information such as the variable name, collection, mode, value, scope, and code-related information.
This makes well-named Boolean Variables useful for design-to-development handoff.
43. Boolean Variables and Developer Handoff
Use clear names that developers can understand without additional explanation.
Good:
isDisabled
isSelected
showBadge
hasError
Avoid:
flag1
state2
boolValue
testBoolean
Consistent naming makes it easier to understand the intended behavior when reviewing designs.
44. Boolean Variable Best Practices
- Use Boolean Variables only for true/false states.
- Use descriptive names.
- Prefer names that communicate a condition or state.
- Use prefixes such as is, has, or show when appropriate.
- Keep related Boolean Variables in logical collections.
- Use component variants when multiple visual states are required.
- Use Boolean Variables for layer visibility when appropriate.
- Test prototype interactions after changing variable values.
- Avoid creating unnecessary Boolean Variables for simple static designs.
- Keep naming consistent throughout the design system.
45. Common Boolean Variable Naming Patterns
| Pattern | Example | Purpose |
| is + State | isActive | Represents a state |
| has + Feature | hasError | Represents existence or condition |
| show + Element | showBadge | Controls visibility |
| can + Action | canSubmit | Represents permission or capability |
| should + Action | shouldAnimate | Represents a conditional behavior |
46. Common Mistakes with Boolean Variables
Mistake 1: Using Boolean for Numeric Data
Do not use a Boolean Variable when more than two numeric values are required.
Wrong:
spacing = true
Better:
spacing = 16
Mistake 2: Unclear Names
Wrong:
flag = true
Better:
showBadge = true
Mistake 3: Creating Too Many Duplicate Variables
Avoid creating separate variables for the same logical state when one well-organized variable can serve the required purpose.
Mistake 4: Confusing Variables with Component Properties
Understand whether the requirement is to store a reusable value or expose a component-specific control.
47. Boolean Variables Workflow
Identify Binary State
↓
Create Variable Collection
↓
Create Boolean Variable
↓
Set true / false Value
↓
Apply to Layer or Variant
↓
Create Prototype Interaction
↓
Change Variable Value
↓
Test Prototype
↓
Document and Maintain
48. Boolean Variables Quick Reference
| Item | Details |
| Type | Boolean |
| Possible Values | true / false |
| Primary Use | Binary states |
| Layer Visibility | Supported |
| Component Variant Properties | Can be mapped to true/false values |
| Prototype Interaction | Can be changed using Set variable |
| Modes | Can represent different values by mode |
| Common Names | isActive, isSelected, showBadge, hasError |
49. Interview Questions on Boolean Variables
Q1. What is a Boolean Variable in Figma?
A Boolean Variable is a variable that stores either true or false.
Q2. What are the two values of a Boolean Variable?
The two values are true and false.
Q3. Where can Boolean Variables be applied?
They can be applied to layer visibility and can be mapped to component variant properties with true and false values.
Q4. Can Boolean Variables be used in prototypes?
Yes. Boolean Variables can be changed through prototype interactions such as Set variable.
Q5. What happens when a Boolean Variable controlling visibility is true?
The associated layer is visible.
Q6. What happens when the value is false?
The associated layer is hidden.
Q7. Give examples of Boolean Variable names.
Examples include isActive, isSelected, showBadge, hasError, and isLoading.
Q8. Can Boolean Variables work with component variants?
Yes. Boolean Variables can be mapped to variant properties that have true and false values.
Q9. Why are Boolean Variables useful in design systems?
They provide reusable binary states that can help manage component behavior, visibility, and interactive states consistently.
Q10. What is the difference between a Boolean Variable and a Boolean Component Property?
A Boolean Variable stores a reusable true/false value, while a Boolean Component Property provides a component-level true/false control, primarily for layer visibility.
50. Boolean Variables Checklist
- Understand true and false values.
- Create a Boolean Variable.
- Use meaningful Boolean names.
- Understand Boolean Variable collections.
- Apply Boolean Variables to layer visibility.
- Understand Boolean Variables and component variants.
- Create selected and unselected states.
- Create enabled and disabled states.
- Create show/hide states.
- Use Boolean Variables in prototypes.
- Use Set variable interactions.
- Understand Boolean Variables and modes.
- Practice with toggle components.
- Practice with navigation menus.
- Practice with e-commerce components.
- Use Boolean Variables consistently in design systems.
51. Learning Path for Boolean Variables
Learn Figma Variables
↓
Understand Variable Collections
↓
Learn Boolean Variables
↓
Create true/false States
↓
Control Layer Visibility
↓
Use Component Variants
↓
Use Prototype Interactions
↓
Use Set Variable
↓
Use Conditional Logic
↓
Build Interactive Components
↓
Create Design System States
52. Key Takeaways
- Boolean Variables store true or false values.
- They are ideal for binary states.
- They can control layer visibility.
- They can be mapped to true/false component variant properties.
- They can be changed during prototype interactions.
- They are useful for selected, disabled, loading, error, and visibility states.
- Clear naming is essential for maintainable design systems.
- Boolean Variables can be combined with modes and prototype logic.
- They help create reusable and interactive Figma designs.
53. Conclusion
Boolean Variables are an important part of Figma's variable system because they provide a simple way to represent two-state conditions. With only true and false values, they can control visibility, component variants, prototype states, and interactive behaviors.
When Boolean Variables are combined with variable collections, modes, component variants, and prototype interactions, designers can create flexible design systems and realistic interactive prototypes with fewer duplicated components and frames. Using meaningful names such as isSelected, isDisabled, showBadge, and hasError also makes the design easier to understand and maintain.