Skip to main content
Question

How to replace local component to component from library

  • March 19, 2024
  • 1 reply
  • 392 views

Tomas_Bana

Hello folks,
I need to replace all component instances on my page to components from library. I try using the function swapComponent but I don’t know if it is the right path. Here is my code:

const old_com = figma.root.findOne(node => node.type == "INSTANCE" && node.name == "Icon") as InstanceNode; 
let new_com = await figma.importComponentByKeyAsync("7c5dd1fbdbd83b87ac6d7XXX");

old_com.swapComponent(new_com)

Nothing happens after starting my code.

Thanks

This topic has been closed for replies.

1 reply

tank666
  • March 19, 2024