Skip to main content
Question

Need Help: Icon with Badge + Color Inheritance Problem in Figma


Andrei_Guk

I’m trying to create an icon component with an indicator (like a dot or badge), but I want to avoid making separate variants for each icon just to show or hide the indicator. Ideally, I’m looking for a simple, reusable setup — maybe using a frame or wrapper.

 

One more thing: when I add the icon (with a color set via a variable) into another component, the color doesn’t inherit as expected — it keeps the original value instead of adapting to the parent context.

 

For context: I’m using icons from a shared library. All icons follow a consistent structure — same layer naming and default color (not linked to any style). Colors are assigned through design tokens at the component level, not directly within the icons themselves.

 

Has anyone found a clean solution for this kind of setup?

 

5 replies

Damian_Oczki
  • Active Member
  • 26 replies
  • March 21, 2025

You can simplify this by only putting one badge in the button component. If you need to control its position like on the screenshot, you can put 4 copies instead and control them on/off independently.

First, place the indicator in the correct position using absolute positioning (click the “Ignore auto layout” button in the Position section of right sidebar). Make sure that proper horizontal and vertical constraints are set. Put the badge on top (bring it to front), so that it’s drawn over the icon.

Then, select a single badge and click the “Apply variable/property” button in the Appearance section. Name the property e.g. “Badge top right”.

Now, if you use an instance of your button component, you’ll have a toggle to show or hide the badge.


Andrei_Guk
  • Author
  • New Member
  • 3 replies
  • March 21, 2025
Damian_Oczki wrote:

You can simplify this by only putting one badge in the button component. If you need to control its position like on the screenshot, you can put 4 copies instead and control them on/off independently.

First, place the indicator in the correct position using absolute positioning (click the “Ignore auto layout” button in the Position section of right sidebar). Make sure that proper horizontal and vertical constraints are set. Put the badge on top (bring it to front), so that it’s drawn over the icon.

Then, select a single badge and click the “Apply variable/property” button in the Appearance section. Name the property e.g. “Badge top right”.

Now, if you use an instance of your button component, you’ll have a toggle to show or hide the badge.

Thanks for the reply!

However, it’s not just about buttons — I’m looking for granular control over icons wherever they’re used. No matter which component the icon is swapped into, I want a consistent and flexible way to control things like showing an indicator or inheriting color, without creating separate variants for each use case.


Damian_Oczki
  • Active Member
  • 26 replies
  • March 21, 2025

In that case, you can create an intermediate component that would be a “wrapper” for your icons, with the addition of badges.

Put an icon instance on the canvas, create a component out of it, and then add badges like described above. Then, in Properties section, click to expose nested instances, and select the icon instance.

Finally, use the wrapper instead of icons directly. Since you exposed the nested instance, you’ll have full control over the badges and the icon instance from the right sidebar.


Andrei_Guk
  • Author
  • New Member
  • 3 replies
  • March 21, 2025
Damian_Oczki wrote:

In that case, you can create an intermediate component that would be a “wrapper” for your icons, with the addition of badges.

Put an icon instance on the canvas, create a component out of it, and then add badges like described above. Then, in Properties section, click to expose nested instances, and select the icon instance.

Finally, use the wrapper instead of icons directly. Since you exposed the nested instance, you’ll have full control over the badges and the icon instance from the right sidebar.

Sorry, it doesn’t work for me :( same issue


Damian_Oczki
  • Active Member
  • 26 replies
  • March 21, 2025

If the icons are individual components and not variants, then you could add an instance swap property to this:


Sadly, I don’t have a solution for Figma resetting the icon’s color. I’ve been struggling with this for years myself and it works 50% of the time, and the other 50% it resets like in your case. I haven’t been able to pinpoint the mechanism behind this.


Reply


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