Skip to main content
Peco-chan
May 29, 2024
Question

How to get the current value of a component?

  • May 29, 2024
  • 5 replies
  • 152 views

Hi community!
Is there any way I can store and use the current dynamic value of a component e.g. the current width of a button. A button e.g. gets automatically wider with autolayout.

❓ Is there a way to get that value, store it and apply it to other objects?

Thanks a lot in advance ❤️

This topic has been closed for replies.

5 replies

Pavel_Kiselev
Power Member
May 29, 2024

Sure thing mate. Just check the docs, they are quite comprehensive

Peco-chan
Peco-chanAuthor
May 29, 2024

Could you perhaps point me to where that’s described or maybe explain how to do it?

Pavel_Kiselev
Power Member
May 29, 2024

Sure, docs are here → https://www.figma.com/developers/api

Peco-chan
Peco-chanAuthor
May 29, 2024

Thanks, but I’m looking for a way how to do that in the UI, I’m a designer, not a developer.
I know I can store values in variables but then they are set.
Let’s say

  • button A has a text that makes the button 100px wide.
  • button B has a text that makes the button 200px wide.
    How can I the current width value of each button and dynamically write it into a variable?
Pavel_Kiselev
Power Member
May 29, 2024

To code something you’d have to invest some of your time to learn basic stuff. If you haven’t made your “Hello Word” yet it’s time 😉 Good luck mate