Here’s a 2-minute video explaining the issue: Dropbox Capture
Basically, icons stop updating their color when I swap variants after I make any change to the original component in its library.
I’ve seen tons of topics discussing icons not changing color, but most (if not all) of them were solved by simply making sure the component layer names were consistent. I’m already using consistent naming and the issue is still there.
One important detail: the issue does not happen on local components.
I’ve just updated the video to make it even more clear: Dropbox Capture
I’ve replicated this with some other tests and figured it out.
The reason for this behavior is the “Icon” layer inside the Button component because you’ve changed the name of the icon component instance.
There are two simple ways to solve this issue:
- Do not rename the Icon component instance and keep its original name (important).
- Nest the icon instance (inside the button) in a new Auto Layout Frame – you can rename this to “Icon” for example.
If you do one or both of these you’ll see that the problem doesn’t occur anymore.
Just update your Button component (each variant!) like this and it should work properly.
That worked, @dwnrdt
Thank you so much
Weirdly, there are tons of topics in this forum saying that components that use the instance swap property need to keep their layer names consistent instead of using the actual icon component name.
Hi guys Did I miss something? by creating an auto-layout frame around the icon?
Can you share more details on the original components structure or provide a test file to look into?
Well I’m guessing the reason is how the Icon components are structured – or to be more clear how they are not structured… The iconset of the referenced WF Design System is probably the problem which causes unwanted color changes.
I can’t really explain why but Figma has many problems with nested icon components changing their colors in different states when the icons themselves have a different layer structure. All icons need to have the exact similar layer structure and layer naming.
Here are two icons as an example I’ve randomly picked from the icon set:
See how their layer count is different?
Goal should be to have every icon structured the same like this for example:
You can do this by merging vector layers with boolean operations (union etc.) or use Flatten (CMD + E / Object>Flatten Selection), or even both. I’ve experienced problems with strokes in icons too, so you should also convert those to paths (Shift + CMD + O / Object>Outline Stroke).
I know that means much manual labor and time you need to invest to get the whole set ready. And maybe it doesn’t even work for every icon especially when multiple colors are involved.
But I suggest you get just a few new icons components ready and test your component and see if it behaves as expected.
Thank you so much for your answer! It was extremely helpful! Fortunately, this is a really small project (a small MVP), hence at the moment I need only 2 icons which needs to be switched sometimes. I just wanted to know what could be the problem, so I can resolve on bigger projects later.
Thanks a lot again!
You’re welcome, glad I could help!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.