Using expression as a variable's value

This is what brought me here. Calculating a value based off the viewport width would be game changing.

+1 for this. I love variables as a feature for many reasons in part because it allows you to see set values in an organized way, and in one-ish place. Feels very hinky to have so much definition/declaration of variables going on only within these small pop-up windows for prototyping. Both tedious and ephemeral compared to being able to set permanent expressions in a database setting.

Having this feature in combination with more available modes, and the ability to change modes conditionally, would be heavenly.

For example, trying to prototype three inter-connected filters menus has been especially frustrating as I need to provide an exhaustive list of if statements covering each combination of filter selection on every menu variation in order to have different options disappear or change with the flexibility of a real menu.

On the other hand, if I was able to create a “mode boolean” whose value was set based on other contingent factors, the only action I would need to define in prototyping on the click of a filter button would be to set that filter to on or off, and the built-in definitions would ensure its effects propagated throughout the environment.

Keeping the conversation alive and confirming I still would like to see this functionality. Today’s case I would like to be able to handle is showing the current year across copyright, publish dates, and last updated text strings. I’d like to set a variable called Year and if I update that in my design system, I want all the dates to show 2024 (where before, it might have been 2023).

Is this still not available ? in 2024

1 Like

This would be immensely valuable, especially for organizations that want to align their design system between Figma and the codebase.

Still looking for this functionality as I am setting up a type ramp based on rems.

Published a plugin that does exactly this, will post a link here after it passes the review :crossed_fingers:

+1 - very much need

https://www.figma.com/community/plugin/1365339609215368041/dynamic-variables
Ok, here’s the plugin, give it a try!
For example, @K16E_Inc request will look like this
{{ $rounder * 1.5 }}

+1, really need this also!
It would save a ton of time and help create clean systems, especially for Type systems, spacing etc.

Im using this personally for my invoicing. Would love to just assign Gross (rate * hours), Goods and Services Tax (Gross * 10%), and Net (Gross + GST). Just set your hourly rate once, then just enter in your hours and you have an invoice.

@Ee_Yern_Ng my plugin can help you! I have already posted an example with tax calculation here: