I am trying to wrap my head around (and staying in control) using slot components in a layout grid component. I might be overcomplicating things, so any input to keep it simpler please pitch in.
What
Having a reusable component where I can change number of items in instances and layout direction.
Why
Having control of instances of master/base components, while having the flexibility of adjusting number of “items” without using show/hide layer, and minimising variants work.
I can somewhat follow why the overrides do what they do, but I still see some behaviour that could be a bug or for me at least unexpected.
Instance resets to slot component
Some changes are kept on reset
Multiple resets to slot component (no text overrides)
Maybe I’m doing something wrong, maybe I am using nested components and overrides in an unintended matter.
Hey mate. You should name your slots, something like “item-1” and so on. Giving the name to each slot would preserve your overrides as you change number of items in your layout grid component.
Right now your slots does not have any name overrides so when you change number of items via variants Figma does not know how to preserve your overrides
UPD Does not seem to work… For some reason Figma does not keep name overrides, whenever I swap a slot with test component it seems fine, however when I change the number of slots it drops the name override
In the video below you can see that whenever I change the number of items rows are loosing their name overrides somehow
I fiddled a bit with changing back and forth between direction and items:
It seems, that switching direction with maximum items reverts the first instance drop. I might be able to use this work around for now, but curios to hear others thoughts on this.
You linked to the thread where I gave the solution to the original author.
Have you tried it? The same solution works for your case as well (even without the “Instance swap” property).
I edited the “LayoutGrid” component and added exposed nested instances properties for the “TestItemGrid” and “FormsCheckboxList” components (to change variants at the top level), and added text properties for the “TestComponent” and “FormsCheckbox” components (to preserve overrides when swap nested instances).