pacocoursey / cmdk

Fast, unstyled command menu React component.
https://cmdk.paco.me
MIT License
9.98k stars 287 forks source link

feat: API for accessing 'scroll' properties of the inner list element #308

Open Lordfirespeed opened 1 month ago

Lordfirespeed commented 1 month ago

I'm trying to implement something like https://github.com/PrinceLoren/shadcn-combobox-virtualized-infinity/.

They aren't using the Command.List primitive because they need access to the scrollTop (and a couple of other properties) of the scroll container, to know when to load more results.

I would prefer to continue using the Command.List primitive, especially since that was made mandatory in cmdk@1.0.0, but would need access to its ref to be able to implement what I want; alternatively, to be specific, the functionality I need consists of

Exporting the useCommand hook would be sufficient for me, but #104 was closed as 'not planned' so that might be off the table. Perhaps another hook such as useCommandListScroll ?