How to
Rename Layer

Rename Figma layer

code.js
// let's grab a layer node by it's ID
const layerNode = figma.getNodeById('123:456');
 
// prevent a figma memory leak (if not found, can't be edited)
if (layerNode !== null) {
  layerNode.name = 'My new layer name';
}