Skip to content
tezvyn:
Menu

Dynamic Counter: State in Figma

MediumHow cards are made

A dynamic counter wires a number variable to a text layer, letting taps change the value. Use it for quantity steppers or pagination in prototypes. The footgun is skipping the text-to-variable binding, so clicks fire but the on-screen number never updates.

Why it exists

Static mockups show state A and state B side by side, but real apps transition between states inside a single component. Designers needed a way to prototype numeric controls that actually accumulate or decrease values during user testing, without building a coded frontend. Dynamic counters bridge that gap by letting a Figma prototype hold simple numeric state.

The mental model

Think of it as a spreadsheet cell wired to two buttons. One cell holds the current count, a text layer displays that cell, and the buttons contain formulas that add or subtract one. In Figma terms, the spreadsheet cell is a local number variable, the formulas are prototype interactions with simple math, and the display is a text layer whose content is bound to that variable.

How it works

Start by creating a local number variable with a default value such as zero. Build your counter component with a text layer for the number and two button layers for increment and decrement. Bind the text layer to the variable so it always reflects the current value. Then add prototype interactions to the buttons. On tap, use the Set Variable action to change the number variable by a fixed amount, such as plus one or minus one. If you need guardrails, add a condition so the decrement button only fires when the variable is greater than zero. Because the text layer is bound to the variable, the display updates instantly across every instance of the component.

When to use it

Use dynamic counters whenever you are usability testing flows that require quantity selection, such as adding tickets to a cart, setting a timer, or configuring a multi-step wizard. They also shine in design system documentation, where a single interactive component can demonstrate minimum, maximum, and default states without maintaining separate frames.

When not to use it

Do not use dynamic counters when the numeric logic grows complex, such as calculating tiered pricing, inventory limits pulled from an API, or multi-field validation. Figma variables handle simple arithmetic and conditionals, but they are not a programming environment. If the counter needs to influence other unrelated components on the same page, you may hit the limits of variable scoping and end up with brittle workarounds.

One canonical example

A conference ticket quantity stepper on a checkout page. The component shows the current ticket count, a minus button disabled at zero, and a plus button capped at ten. Each tap updates the variable, which simultaneously changes the displayed count and could theoretically feed a total price variable elsewhere on the page. During testing, stakeholders can tap through the flow and watch the numbers react exactly as they would in production, surfacing edge cases like zero-state copy or maximum-inventory messaging before engineering writes a line of code.

Interview question

During user testing, your Figma quantity stepper buttons animate on tap but the displayed number never updates. What is the most likely oversight?

  • a.The number variable was given page-level scope rather than local scope
  • b.Each button was assigned its own separate number variable
  • c.The text layer content was never bound to the number variableCorrect
  • d.The buttons use variant interactions instead of Set Variable actions
Why?

The card identifies skipping the text-to-variable binding as the footgun that causes clicks to fire while the on-screen number stays static. Using variant interactions instead of Set Variable is a different mistake, but the display will still never update unless the text layer is explicitly bound to the variable.

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