T
TanStack•3y ago
optimistic-gold

Styling Virtualized List issue

Hi everyone, I'm farily new to working with TanStack Virtual library and it seem's I'm constantly battling styling issues as there is alot of position absolute. Is there a way to add spacing between elements in a list ? Do items within a virtualized list need to be have a position of absolute ? Surely I'm not the only one sturggling to get to grips of how to keep virtualized elements styling the same before adding virtualization. I would try searching the docs via the search functionality though there seems to be some sort of technique issue related to the Algo implimentation. Any comments are greatly appreciated 😄
2 Replies
optimistic-gold
optimistic-goldOP•3y ago
UPDATE: I can see why position absolute and the transform is needed, so then how easy can you add spacing between elements.
No description
stormy-gold
stormy-gold•3y ago
I think the easiest way to do this is to use a wrapper element that has a top or bottom margin That way the measurement logic still works the way you would expect it too and the visual spacing is just that, a visual thing.

Did you find this page helpful?