Skip to content
tezvyn:
Menu

Prototype a conditional Submit button with Figma variables

MediumHow cards are made

Tests boolean logic in Figma prototyping. Strong answers bind inputs to string variables, conditionally check that email and password are non-empty, then toggle a boolean to enable Submit.

What's really being asked

This question evaluates whether a designer understands Figma's modern prototyping paradigm beyond basic click-throughs. At the senior level, interviewers want to see fluency with variables, conditional logic, and expression-based interactions introduced in Figma's advanced prototyping updates. The core concept is state management: using local variables to capture user input, evaluating that state at runtime, and dynamically updating UI properties without creating redundant artboards. It also reveals whether the candidate understands the difference between presentational components and interactive logic layers.

The full answer

First, the candidate should mention creating local variables scoped to the prototype, specifically string variables for the email and password fields and a boolean variable for the button's enabled state. Second, they should describe wiring each input field to update its corresponding string variable on text change, typically using the Set Variable interaction. Third, they need to explain the conditional check: on each input change, evaluate whether both string variables are not equal to empty strings. Fourth, they should describe toggling the boolean variable based on that conditional result and binding the Submit button's interactive property, such as its main component variant or navigation action, to that boolean. Optionally, they might mention using the boolean to swap between disabled and enabled visual styles via variant properties or layer visibility.

The mistakes people make

A major red flag is suggesting manual duplication of frames to represent every possible state, such as empty form, email only, password only, and both filled. This indicates the candidate is stuck in a pre-variables workflow and lacks scalability thinking. Another red flag is confusing component properties with prototype variables, for example claiming that auto-layout or variant switching alone can detect text content without any variable binding. A weaker answer might also omit the conditional logic entirely and suggest an on-click check on the button itself, which fails the requirement that the button becomes enabled reactively as the user types.

What usually comes next

The interviewer might ask how to handle validation beyond emptiness, such as regex email checking, which in Figma would require more granular conditionals or nested if-statements if supported. They might also ask how to scale this across multiple forms, prompting a discussion about variable collections, modes, or component properties paired with variables. Another follow-up is error handling: how would you show inline validation messages using variables, or reset the form state after submission.

A concrete example

Imagine a login frame with two text inputs and a primary button. Create local variables named emailInput and passwordInput as strings, and isFormValid as a boolean defaulting to false. On the email input layer, add an interaction trigger for On Change that sets emailInput to the typed text, then add a conditional that checks if emailInput is not empty and passwordInput is not empty, setting isFormValid to true if both pass, else false. Repeat the same logic on the password input. Bind the Submit button's click interaction to only fire when isFormValid is true, and bind its visual state to a variant property driven by that same boolean so it appears grayed out when false and blue when true.

Interview question

In Figma, how do you prototype a Submit button that enables only after both email and password fields contain text?

  • a.Create string variables for each input, add conditional logic on text change to check both fields are non-empty, then toggle a boolean bound to the button's enabled state.Correct
  • b.Add an on-click interaction to the Submit button that checks the input fields and conditionally allows navigation.
  • c.Rely on auto-layout and component variant properties alone to detect when text layers are no longer empty.
  • d.Duplicate the frame for every input combination and use navigation actions to switch between them as the user types.
Why?

This method uses local variables to store input state and evaluates a conditional expression on every keystroke to toggle a boolean that drives the button reactively. The on-click approach is tempting but wrong because it only validates after the user tries to submit rather than enabling the button dynamically while typing.

Just read this? Test yourself on what you have been reading.

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.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on figma — each one lists the topics its interview covers.

See open roles