Figma Support Forum

Is it guaranteed that all components have a non-empty key?

After some updates last year, every component I could find now has a non-empty key, even if it’s not published to the library. Before that, the key was only available on components that are published to the library, otherwise it was an empty string "", as far as I remember.

I want to use the key as a key in the dictionary and I’m wondering if it would be ok to do that? Do all components now have a unique key? Or could there still be some old files that have empty string as a key?

All components should have a key when accessed through the plugin API yes. This did indeed change a few months back since we did some bigger changes to the internals of components and instances

1 Like