Skip to main content
Question

Most efficiënt way to create component with hover state


Onno_Willems

My design is getting really big and slow, so I am looking for the most efficiënt way to create hover states on components. 

 

I have a bunch of pretty big/complex components that represent a conveyor track in my design. They include shapes, shadows, text (sizes), icons, etc. When the user hovers over them they get a different color to indicate that they are selectable, similar to a button.

I now have a normal state, and a hover state that is exactly the same, only with a semi-transparent hover shape in a different color on top of it. I do not really like this approach, as I have to maintain both states if an icon or something changes, and it feels dump to just have the whole thing duplicated. I am also thinking my components have double the amount of shapes they really need, causing additional slow-down. 

 

I was thinking of extracting everything in a track part component into a ‘base shape’ component and include that in both states, but I am not sure this will actually help (it's a lot of work, as all instances that have overrides need to be done again).


Any recommendation as how to do this the most efficient?

 

(I use my components also for interactive prototyping, so I would like the hover to work on all instances).

2 replies

Onno_Willems
  • Author
  • New Participant
  • 9 replies
  • February 12, 2025

Nobody has any experience with this?


Onno_Willems
  • Author
  • New Participant
  • 9 replies
  • March 26, 2025

For the interested, tried many things but in the end it left as I had it before.

  • Extracting everything that is used in both the normal and hover state into a ‘base’ component does not really work, as the hundreds of instances that are used in the actual design are scaled as desired. Figma does not handle scaling and switching component variants very well (often when switching variant the hovered state jumps back to its original scaling).
  • Still feels dumb to have both component states fully duplicated (except for that hover overlay). Would love to bind that to a boolean visibility variable that changes on hover, but that would require local component variables which Figma does not support (else all instances highlight at the same time.)
  • Didn't find another solution.

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