[PLUGIN API] Link TextNode characters to component property

I am developing a little Figma plugin using the Plugin API.

I am working with a TextNode withing a Component.

The component has a TEXT proprety configured.

I am tring to link the content of the text node to the value of the component’s proprety using the API

Below is the exact UI functionality that I am aiming for.
Screenshot 2024-01-12 at 14.34.37

I haven’t found anything that would help in the Plugin API refference.

Can you guys point me in the right dirrection?

10x

2 Likes

I went trough all the specs for TextNode and Component event did a deep dive with the console debugger… no luck…

If I look at a node where I set this from the console, it appears as a bound variable to the “characters” key of the TextNode, but if I try to use setBoundVariable(“characters”, propID) it fails.

Sorry, but what does variable binding have to do with it? You want to apply the component’s text property, right? The componentPropertyReferences property of the TextNode, to which I left a direct link in the previous post, is what you need.

my mistake… I missread the link on the phone. It scrolled to top and missed the point.

Just tried it now. Works!

Many thnaks!!!

Sorin

@Bogriceanu_Sorin Hey, I’m trying to achieve this same thing. Can you share your code? I’m not clear on how to create new componentPropertyReference item.

TextNode.componentPropertyReferences = {characters: 'TextPropertyName#0:1'};
1 Like