Closed
Description
I have everything working with use-select
except the search.
When I use the setSearch
function like so:
<input
type="text"
name="search"
autoComplete="off"
onChange={(e) => {
setSearch(e.target.value);
}}
className="focus:ring-indigo-500 focus:border-indigo-500 block w-full pl-9 sm:text-sm border-gray-300 rounded-md"
placeholder="Search"
/>
visibleOptions
always returns an empty array, no matter what I search for.
Also I try to override the filterFn like so:
const searchFilter = (options, searchValue) => {
console.log(options, searchValue);
return options;
};
const {
visibleOptions,
selectedOption,
getInputProps,
getOptionProps,
isOpen,
setOpen,
setSearch,
searchValue,
} = useSelect({
multi: true,
options,
value,
onChange,
optionsRef,
filterFn: (options, searchValue) => searchFilter(options, searchValue),
});
the searchFilter
function is never called (it never logs anything).
Metadata
Metadata
Assignees
Labels
No labels