Skip to main content
Solved

How do I “swap” icons in a component to create more variants?


Jess5

Super new to Figma so apologies if this has been asked before or isn’t phrased properly.

I’ve created a component with 2 variants: selected and unselected.

I want to create a navigation bar for a mobile app that has different icons for each option - e.g. Home, Popular, Hottest, TV Shows (see bottom). The house icon I’ve used here is from a plugin.

Is there any way for me to “replace” each icon easily? Or do I have to detach, delete,and add new icons manually for each new variant?

I’m also not sure how to centre long text underneath each variant, I’m guessing I have to detach it?

Best answer by Brian_Saunders

To elaborate on Gleb’s answer, you first would need to make the individual icons into components in your Figma file. Then you need to use instances of those icons to build your bigger components. If your Nav Icons component is made of those instances, and your Nav Bar component is made of them as well, you will be able to select the icon instances and swap them out using instance swapping in the right-hand panel.

So, it seems you’re missing the bottom level of components—the icons themselves. Once you have those built everything will fall into place for you.

You have a few options for centering the text. You can use auto-layout to do that or just select center alignment on the text itself and position the text in the middle of the frame, with center constraints set on it so it resizes properly.

View original
This topic has been closed for comments

4 replies

Gleb
  • Power Member
  • 4706 replies
  • July 17, 2021

Use regular instance swapping for icons: Figma Tutorial: Components - Swapping and States - YouTube


Brian_Saunders

To elaborate on Gleb’s answer, you first would need to make the individual icons into components in your Figma file. Then you need to use instances of those icons to build your bigger components. If your Nav Icons component is made of those instances, and your Nav Bar component is made of them as well, you will be able to select the icon instances and swap them out using instance swapping in the right-hand panel.

So, it seems you’re missing the bottom level of components—the icons themselves. Once you have those built everything will fall into place for you.

You have a few options for centering the text. You can use auto-layout to do that or just select center alignment on the text itself and position the text in the middle of the frame, with center constraints set on it so it resizes properly.


Jess5
  • Author
  • 1 reply
  • July 21, 2021

Thanks Brian!


  • 0 replies
  • August 20, 2021

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.


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