Hi, all. I’m working on a plugin to automate design specs. One of the ideas is to visually highlight the components of a shared library and show it’s name and properties.
So far, through the INSTANCE nodes I’m able to get the properties, but no the main-component name.
For example, I’m able to get this from a component called Button:
But if it’s a library component and not a local one, you need to load it first using figma.importComponentAsync and instance.mainComponent.key — although looks like you are already getting properties successfully so that’s probably not the case.
The issue is that when doing console.log(component.name) it logs Type=Secondary, Size=Default, Icon=None, State=Default, Disabled=No which are the properties, instead of the actual component name, which I expect to be Button
That’s the actual name of a variant component inside of a variant set. If you want to get the name of the variant set the main component belongs to, you need to get its parent, e.g. instance.mainComponent.parent.name.