Skip to main content
Derek_Watson
Mar 13, 2024 1:24 PM UTC
Solved

Is it possible to update the children of an existing component using the plugin API?

Is it possible to update the children of an existing component using the plugin API?

I am working on a plugin that generates icon components for a library from raw SVGs. The generation part is pretty straightforward, but I’d also like to be able to update the existing Figma components when there are changes to the SVGs without breaking the component instances.

The children property is readonly and I haven’t been able to find another way to remove the existing children of the ComponentNode so that I can add the updated children. Is there something I missed?

This topic has been closed for replies.
tank666
tank666Solution
Mar 13, 2024 1:45 PM UTC

Call remove() on the child node you want.

figma.com
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank

2 replies

tank666
tank666Solution
Mar 13, 2024 1:45 PM UTC

Call remove() on the child node you want.

figma.com
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Derek_Watson
Mar 13, 2024 1:47 PM UTC

Thanks! I actually just figured it out 😅 Don’t know why I struggled with that one for so long.