Figma Support Forum

Button Variants: How do I prevent swapped icon overrides from showing after setting icon property to "none"?

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

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? :thinking:

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

Thank you.

Hey, @MadsHenriksen

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

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?

1 Like

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