Change instance variant independently with variables

Hi. I only recently learned how to use variables in Figma. So I have a set of instances of the same component and I want them to interact between each other. Basically, it’s a bike icon and I want that when you click on one it goes to variant2 (selected) and the other instances remain on the default variant (unselected). How can I do this? I attach image.

Here’s another screenshot so it’s better understood. The icon with the black bike would be the default state, and the one with the red bike would be the selected state.

@Sergio16 Here is an example file, where I used variables & conditionals to set/reset the variant states of several location tags on a map. Hope this helps!

Get Example File
View Prototype Example

Thank you very much, @Nate_G . That does exactly what I was looking for. I arrived to the same solution by grouping all bike icons and turning them into a component. Then I created different variants, each one with a different bike icon selected. Then I used variables to select one variant or the other depending on the icon clicked. Thank you for putting this together, it’s going to be useful for other people as well.

1 Like