Replies: 1 comment 4 replies
-
|
The ListBox actually handles its own filtering based on the filter function and value provided on the Autocomplete context. This is so that Autocomplete doesn't need to know about the structure of the data and we don't need to pass the collection state up, which would be a little reversed from the usual data flows down approach. Assuming you are declaring your items as a data object, you could use the same filter function that you send to the autocomplete to determine what "all" currently is during the input's onChange. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to build a component using the Select + Autocomplete example from the new docs (or a similar one that Devon also shared on X awhile back), with one small addition - I also need to have "Select All" and "Select None" buttons added within the Popover to quickly select / deselect the options.
Here's an example of what I mean: https://stackblitz.com/edit/6ppf3ucz?file=src%2FExample.tsx
I can get it working just fine with selecting ALL items in the collection. However, when the list is filtered using Autocomplete, I need the "Select All" button to select only all visible items (ie. filtered ones), and not all of the items in the original list.
Is this at all possible with the current components? Is this stored in a particular context that I can read from? I've tried using
AutocompleteStateContext,ListBoxContextandSelectStateContextbut none of them seem to expose the filtered state.Would appreciate some help on how to tackle this. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions