[Feature Request] Select component with textfield filter #1586
Replies: 7 comments 6 replies
-
If no one is working on this I'd love to start working on it. |
Beta Was this translation helpful? Give feedback.
-
Hey @Yuroq thank you!, however, we're already working on it |
Beta Was this translation helpful? Give feedback.
-
Use the Autocomplete component https://nextui.org/docs/components/autocomplete component. |
Beta Was this translation helpful? Give feedback.
-
@jrgarciadev There is a fundamental change in perception between Autocompletion and searching in a Select field. Selecting AutoComplete changes the input value to the selected value. The above issue causes performance issues mainly when using a list from an asynchronous source. I use with react-aria's useAsyncList as you suggest here https://nextui.org/docs/components/autocomplete#asynchronous-filtering If you take the example component that you put in the documentation above and just add a value control to it: import React, {useState} from "react";
import {Autocomplete, AutocompleteItem} from "@nextui-org/react";
import {useAsyncList} from "@react-stately/data";
export default function App() {
const [value, setValue] = useState('');
let list = useAsyncList({
async load({signal, filterText}) {
let res = await fetch(`https://swapi.py4e.com/api/people/?search=${filterText}`, {signal});
let json = await res.json();
return {
items: json.results,
};
},
});
return (
<Autocomplete
className="max-w-xs"
inputValue={list.filterText}
isLoading={list.isLoading}
items={list.items}
label="Select a character"
placeholder="Type to search..."
variant="bordered"
onInputChange={list.setFilterText}
onSelectionChange={setValue}
selectedKey={value}
>
{(item) => (
<AutocompleteItem key={item.name} className="capitalize">
{item.name}
</AutocompleteItem>
)}
</Autocomplete>
);
}
It's also impossible to select a multiple choice, and actually you can't personally format the value, and this is a result of the fact that you are using a real text field... Hope I understood, and would like to receive a better offer or a more successful solution... |
Beta Was this translation helpful? Give feedback.
-
Does anyone have a solution for this function? |
Beta Was this translation helpful? Give feedback.
-
Quite disappointing that this isn't a feature and that @Jkayed wanted to contribute and was shut down. |
Beta Was this translation helpful? Give feedback.
-
This example might help @duonghungkiet @user72356
Screen.Recording.2024-11-12.at.7.54.11.PM.mov |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
For longer list is hard to find items.
Describe the solution you'd like
the new select item is cool. it would be awesome if could be a search text input like react-select library.
Describe alternatives you've considered
text input to filter select items.
Screenshots or Videos
something like this:
Beta Was this translation helpful? Give feedback.
All reactions