Figma Support Forum

Cannot access node properties

Hi guys,

In my plugin I’m trying to find all component nodes so I can get their “key” property, however I am unable to access the “type” property of any of the nodes in my document so that I can filter out accordingly.

I have identified the id of one of the nodes I want to access and used const node = figma.getNodeById(nodeId) to check its properties however the outputted Node object doesn’t seem to have any accessible properties other than id (example output: {id: "119:2745"}).

Similarly, if I try node.type on any node returned by figma.root.findAll() or figma.currentPage.selection, it returns undefined. The only property that works is node.id.

Could there be something wrong with how my project is set up or am I missing something in accessing a node’s properties?

Everything should work. Perhaps the problem is caused by your code.

Expand all the properties of the node by clicking on the triangle to the left of the object in the console.

For example:

> TextNode {id: "0:1"}

You can also check this code right in the Figma console, which will output the node type. Preselect any layer.

figma.getNodeById(figma.currentPage.selection[0].id).type

Hi Yury,

The above code did work and it helped me realise that I was sending the list of Node objects to the plugin UI to extract and display the properties, instead of extracting the properties first then post that to the UI.

Many thanks for your help!

1 Like