You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SlotNode: Cannot place content into slot inside instance via appendChild #351
Attempting to programmatically fill a slot node inside an instance throws:
in appendChild: Cannot move node. New parent is an instance or is inside of an instance
Reproduction
constbuttonVariant= ...;// ComponentNode containing a SlotNode named 'icon'constinstance=buttonVariant.createInstance();instance.setProperties({[showIconKey]: true});// make slot visibleconstslotNode=instance.findOne(n=>n.name==='icon');// finds the SlotNodeconsticonInstance=iconComponent.createInstance();slotNode.appendChild(iconInstance);// throws
Expected behavior
Slots are explicitly designed to accept dropped content — that's their entire purpose. The plugin API should allow placing a component instance into a slot node, mirroring what a designer can do by dragging in the Figma UI.
Either appendChild should work on SlotNodes inside instances, or a dedicated method (e.g. slotNode.assignContent(componentNode)) should be provided.
Context
Building a plugin that generates component documentation pages. For the examples frame, we want to show buttons with icons already placed in their slots. We had to fall back to detachInstance() to work around this, which means the examples are no longer live instances.
Noticed this while working against the owong/slots-plugin-typings branch — tagging in case that's the right person to loop in.
Workaround
constframe=instance.detachInstance();// slot becomes a plain FrameNodeconsticonFrame=frame.findOne(n=>n.name==='icon');iconFrame.appendChild(iconInstance);// works, but instance is now detached
Hi @kevinj-rsp, I am one of the engineers working on slots. I was not able to repro in a simple case using the commands you provided. appendChild was able to parent the instance into the slot node for me. If you're able to provide either a video repro or a link to a file (you can share with support-share@figma.com) plus some explicit repro steps I am happy to look further! The only other debugging step I can provide would be to double check the slotNode is a SlotNode type.
As an aside, we have merged the slot typings into the main branch so you should be able to use that as reference rather than the separate branch.
Activity
owalker-figma commentedon Mar 26, 2026
Hi @kevinj-rsp, I am one of the engineers working on slots. I was not able to repro in a simple case using the commands you provided.
appendChildwas able to parent the instance into the slot node for me. If you're able to provide either a video repro or a link to a file (you can share with support-share@figma.com) plus some explicit repro steps I am happy to look further! The only other debugging step I can provide would be to double check theslotNodeis aSlotNodetype.As an aside, we have merged the slot typings into the main branch so you should be able to use that as reference rather than the separate branch.