Skip to main content
Question

How to set the property of a single instance of a component using another component in prototyping

  • May 24, 2024
  • 1 reply
  • 240 views

Hi all,

I’m trying to prototype an interactive map+card list interface, where you can click on a map pin and have the corresponding card scroll to the top and visually change in some way to denote that it’s selected.

The cards in my list are all instances of the same component, and they have a “state” variant (default, selected) with a visual border change.

I’ve had no issue with creating the on-Click interaction to scroll the list to the corresponding card. What I’m stumped on is how to add the component state change to the on-Click trigger.

When I try to create a variable for the component variant, the on-Click action changes ALL instances of the component, not the specific one associated with the specific map pin.

Logically, I want it to be something like “onClick, set variable ‘state’ of target instance to ‘selected’”.

This topic has been closed for replies.

1 reply

  • Figmate
  • 2002 replies
  • May 28, 2024

Hi @Emily_Baldi, Thanks for reaching out about this. I’m not completely sure about your variable settings, but it sounds like you applied a variable to the component and update it through interactions.

In that case it also update any other elements that are linked to that same variable, so I suspect all instances have been updated.
One suggestion I have is to try creating a separate variable for each instance, allowing them to update individually.
You can check more about here : Use variables in prototypes

I know it might not be exactly what you’re aiming for, but I came across an example called “Add an error message for empty selection states” on the Advanced Prototyping Examples page.
The design have two instances and guide you through create two variables that apply to each instance. Please take a look when you get a chance!

If the information above doesn’t quite help, feel free to explore our community on your own. You might find a design file that inspires you here: https://www.figma.com/community/

I hope this gives you a bit of assistance. Please let us know if there’s anything I’ve misunderstood. Also, if anyone from our community has further insights or tips, don’t hesitate to share!

Thanks,


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings