I have a large number of icons defined as individual unrelated Components meaning they are not under a blanket ComponentSet. For each of the Components I have generated a code connect file using the Templates V2 API directly. They look like 👇 with the value of type based on the Component's name.
const figma = require('figma');
export default {
example: figma.code`<my-icon type="foo"></my-icon>`,
metadata: {
props: {
type: 'foo'
}
}
}
Looking at the export format docs I expected metadata.props to allow me to pass arbitrary data to a parent template like this 👇 .
const figma = require('figma');
const instance = figma.selectedInstance;
const iconInstance = instance.getInstanceSwap('Icon');
const iconType = iconInstance.executeTemplate()?.metadata?.props?.type;
export default {
example: figma.code`<my-button icon="${iconType}"><my-button>`,
metadata: {
props: {
icon: iconType,
}
}
}
But I'm not getting back anything when trying to get metadata.props.type.
So my question is are there restrictions on what can go on metadata.props?
Thanks in advance!