Skip to main content

I’m currently creating a codegen plugin and I need to get the , here is what I mean by “typography’s name” in edit mode:

image


I can get all the other data but not its name, which is what I actually need 🥲

Get the name of the text style.

figma.com

Thanks for the quick reply but they are not actually the same, name seems to refer to the node’s name as seen above the node and in the console (node.name) on this screenshot:


But i’m actually looking for the typography’s name, Desktop/Headings/H4 in the screenshot


It’s because you didn’t get the style. To get the style you need to use the getStyleById method.

figma.com

Oh I see, thanks a lot!


For anyone stumbling upon this issue, here’s a minimal example:


figma.codegen.on("generate", async (e: CodegenEvent) => {
const node = e.node;

if (node.type === "TEXT") {
console.log(figma.getStyleById(node.textStyleId).name);
}
})

Reply