Rendering different code based on the parent component. Is it possible?
In Figma we rely on a List primitive to output a type of UI across multiple components. So for example:
- Select Dropdown
- Side Navigation
- Mobile Navigation
These 3 components may all use the List primitive. But in our SDK implementation we do not use the same component for each.
Is there a way to identify through code connect when a "List" is being consumed in "Component A" vs. "Component B" and based on that offer a different output?
@rkieru I had this same exact question. I gave a longer, more annoying version of this question here 😛
I think it would be nice if we could provide an optional param to figma.children. I could see it looking like:
children: figma.children("_ / ListItem", <DropdownListItem>),
or:
children: figma.children(["_ / ListItem", "_ / Icon"], [<DropdownListItem>, <DropdownIcon>]),
Figma friends, do you accept PRs from forks?
I would like to follow up on this feature as it would be of great utility to my team. Being able to assign “Instance of Child X in Component A” to a specific code connect asset allows our designers to reuse components in Figma, while still allowing the SDK output to reflect accurately.