All list not rendering in shadcn Select component
I have 242 items on my options array. But virtualizer only render 42 items. Can someone help me to fix my issue?
You can see the example here: https://stackblitz.com/edit/vitejs-vite-dt6km4bw?file=src%2FApp.tsx
Nurul Islam
StackBlitz
Vitejs - Vite (forked) - StackBlitz
Next generation frontend tooling. It's fast!
6 Replies
passive-yellow•11mo ago
Hi, you need to use useVirtualizer, set scroller element also position the elements, checkout the fixed example
national-goldOP•11mo ago
useVirtualizer is not render anything. I have tried that before
passive-yellow•11mo ago
Did you pass the correct scroll element via getScrollElement? Without it virtualiser will not render anything as it dosen't know what to
national-goldOP•11mo ago
because of
<SelectContent> component render on a portal, that's why maybe getScrollElement can't find it's element
but it's working on useWindowVirtualpassive-yellow•11mo ago
@Laam simplified bit the example but overall something like this https://stackblitz.com/edit/vitejs-vite-9idak5la?file=src%2Fcomponents%2FUiColorSelect.tsx
Damian Pieczynski
StackBlitz
Vitejs - Vite (forked) - StackBlitz
Next generation frontend tooling. It's fast!
national-goldOP•11mo ago
Thank You So Much @piecyk ❤️