Skip to main content
Question

Can't get file nodes of component instance children

  • August 14, 2024
  • 0 replies
  • 120 views

James_Alexander_Lee

I’ve been using Figma’s REST API to grab the text content from specific nodes in my designs with the following endpoint:
https://api.figma.com/v1/files/${fileKey}/nodes?ids=${nodeId}

I would then be able to extract the actual text content from the characters key:
response.data.nodes[nodeId].document.characters

In dev mode, I could easily get the node-id from the URL while clicking around my design.

However, I’ve noticed that for component instances, the children nodes have the same node-id as the parent, thus making it difficult to extract the exact text that I need.

I’ve tried using the “Node Inspector” plugin to see the internal id but it gives me ids like "I5912:74596;5912:74456" which don’t work with the API endpoint.

Does anyone know how I can achieve this?

This topic has been closed for comments

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