79110118

Date: 2024-10-21 12:54:55
Score: 1
Natty:
Report link

To apply component properties to a node, use the componentPropertyReferences property. Also note that the addComponentProperty() method returns a unique property ID, which you need to use in componentPropertyReferences and setProperties().

// Add component's text properties
const prop1 = componentNode.addComponentProperty('PropertyName 1', 'TEXT', '');
const prop2 = componentNode.addComponentProperty('PropertyName 2', 'TEXT', '');

// Apply these properties to text nodes inside component
textNode1.componentPropertyReferences = {characters: prop1};
textNode2.componentPropertyReferences = {characters: prop2};

// Set new values for component properties
instanceNode.setProperties({[prop1]: value1, [prop2]: value2})

Please read the documentation:

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: tank666