Figma Boolean Variables: State Without Variant Sprawl
A boolean variable is a light switch for your component: one true/false value reveals badges or loaders instantly. Use it for binary states like visibility across a system. The trap is wiring too many switches into one component, making debugging a hunt.
Why it exists
Before variables, managing state in Figma meant creating a separate variant for every combination. A button with a loading state, an error state, and an optional icon could balloon into eight variants. Updating a corner radius or font size required manually syncing every single one. Boolean variables were introduced to collapse these binary branches into a single component controlled by true or false flags, so a design system can scale without exploding maintenance overhead.
The mental model
Think of a boolean variable as a light switch that controls several fixtures at once inside a component. Instead of building two rooms, one dark and one lit, you wire one switch to the bulbs. When the switch is false, the layers are hidden or inactive; when true, they illuminate. The variable is the single source of truth for that dimension of state, and every layer bound to it reacts together.
How it works
You create a boolean variable in the Variables panel, then bind it to supported properties such as layer visibility or component instance swaps. In practice, this usually means linking the variable to a layer so that false equals hidden and true equals visible. You can also combine booleans with other variable types, for example using a boolean to toggle whether a number variable drives spacing or not. When you change the boolean value at the component level, all instances update immediately. In prototyping, interaction triggers can flip these variables to simulate state changes like opening a modal or toggling a switch.
When to use it
Use boolean variables for any binary decision that recurs across components. Common examples are showing or hiding a loading spinner on a button, revealing an error icon on an input field, toggling badge visibility on a card, or switching between empty and populated states in a list. They are especially powerful when the same true or false condition should affect multiple sibling layers, because one variable keeps them synchronized without nested variants.
When not to use it
Do not use a boolean variable when a state has more than two values. Button hierarchy, for example, is not true or false; it is primary, secondary, or tertiary, which calls for a string variable or variant property. Avoid using booleans to store content like labels or hex codes. Also resist the temptation to create a component with ten boolean switches; debugging why a layer is missing becomes a combinatorial nightmare, and the component becomes fragile.
One canonical example
Consider a card component that optionally displays a New badge. Without a boolean variable, you maintain two variants: Card and Card with Badge. When the brand color changes, you update both. With a boolean variable named showBadge, you build one card component, bind the badge layer visibility to showBadge, and expose the variable as a component property. On your dashboard mockup, you set showBadge to true; on the archive page, you set it to false. When the badge color changes next quarter, you edit one layer in one component, and every state inherits the change automatically.
Interview question
A designer is building a card component that optionally shows a 'New' badge. Which strategy best uses boolean variables to keep the system maintainable?
- a.Bind a single boolean variable to the badge layer's visibility and expose it as a component property.Correct
- b.Add boolean switches for the badge, an error icon, a loader, a bookmark, and an avatar overlay to the same component.
- c.Create two variants—Card and Card with Badge—and manually sync design changes between them.
- d.Use a string variable with values 'visible' and 'hidden' to control the badge layer's opacity.
Why? this is the answer
Binding one boolean to the badge layer's visibility replaces two variants with a single maintainable component. Option B is tempting because it uses more booleans, but the card warns that wiring too many switches into one component creates a combinatorial debugging nightmare.
Just read this? Test yourself on what you have been reading.
- #figma
- #design-systems
- #variables
- #component-architecture
- #ui-state
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on figma — each one lists the topics its interview covers.
See open roles