I wonder if it is possible to pass a custom function for the loop prop? So that when using e.g. TanStack Virtual. The <Command.Item can be looped from the virtual end instead of from the end in the dom.
(Please correct me if I use the wrong word, I'm new to react).
Currently, when using the TanStack Virtual + loop prop, it behaves like this:
It is normal and as expected to go down from the top with the arrow, but when going up, the item does not reach the end of the virtual list, but the end of the dom. Same for when doing up from the bottom, the item does not reach the top of the virtual list, but the top of the dom.
So it would be nice to have a custom function for loop prop to scroll to top/bottom:
e.g., call parentRef.current?.scrollTo({ top: 0}); when reaching the bottom of the list, and press the down arrow.
https://github.com/pacocoursey/cmdk?tab=readme-ov-file#command-cmdk-root
I wonder if it is possible to pass a
custom function
for theloop
prop? So that when using e.g. TanStack Virtual. The<Command.Item
can be looped from the virtual end instead of from the end in the dom. (Please correct me if I use the wrong word, I'm new to react).Currently, when using the TanStack Virtual +
loop
prop, it behaves like this:It is normal and as expected to go down from the top with the arrow, but when going up, the item does not reach the end of the virtual list, but the end of the dom. Same for when doing up from the bottom, the item does not reach the top of the virtual list, but the top of the dom.
So it would be nice to have a custom function for
loop
prop to scroll to top/bottom: e.g., callparentRef.current?.scrollTo({ top: 0});
when reaching the bottom of the list, and press the down arrow.