Hi,
I’m just starting with Figma plugins and struggling with reading and editing Component Properties. In a very simple case, I’d like to change all property names and values to lowercase.
I don’t understand how to use editComponentProperty
and can’t make sense of the documentation.
Here’s the code that I have so far:
function start() {
const doc = figma.currentPage;
const components = doc.children;
for (const component of components) {
if (component.type === 'COMPONENT' || component.type === 'COMPONENT_SET') {
const componentPropertyDefinitions = component.componentPropertyDefinitions;
for (let propertyName in componentPropertyDefinitions) {
const propertyDefinition = componentPropertyDefinitionsepropertyName];
propertyName = propertyName.toLowerCase();
component.editComponentProperty(propertyName, propertyDefinition);
}
}
}
}
Thanks a lot for your help