Skip to main content

First of all, I apologize if my question is a bit confusing - I found it very difficult to describe the issue I’m having 😅


So I have this button component that uses Variants. The component has an Icon property that can be set to None / Left / Right / Both, and it works great!


Swapping the nested icon also works as intended, but if I, for some reason, decide to hide the left/right icon later (e.g. Icon: None), the icon still shows.


Any idea of what I’m doing wrong here? 🤔



If it helps, my button components has the following layer structure:

image


Thank you.

Hey, @MadsHenriksen


I explained some best practices here so this doesn’t happen:

Figma – 1 Feb 21

Basically, you should wrap your “icon collection” instance inside a new Icon component that is the one attached to the variant properties.


That did the trick!


Thanks @Bruno_Figueiredo


Nice! But this does mean you need to go a level deeper when replacing the icon. Which may not be very intuitive for people who don’t know about this workaround?


@Thor_Johannes_Wang Yeah, and I believe the Figma team is working on this for the upcoming Figma Variants updates.


@Bruno_Figueiredo Your solution worked just awesome!! I was really grateful for that … but all of sudden Figma stopped swapping the icons AT ALL?! Is that a bug or did something happen so the concept above is not working anymore?