material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

Enable Search in SelectField

Open sujilnt opened this issue 10 years ago • 22 comments

Problem description

i wanted to create a component in material ui like adding a input searchbox inside a selectfield, Right now I have done using autocomplete but its not giving accepted behaviour . pasted image at 2016_10_12 04_18 pm

sujilnt avatar Oct 13 '16 04:10 sujilnt

Let me explain the issue. We are using SelectField but we want a search field inside SelectField which can be controlled by flag called enableSearch.

This will be useful when item list is very long. Example country dropdown !!

nsisodiya avatar Oct 13 '16 04:10 nsisodiya

I'm closing that issue for #1956. It has been resolved with 3 potential solutions. Have a look at the end of the thread.

oliviertassinari avatar Mar 26 '17 16:03 oliviertassinari

Hey there! Sorry, looks like the solutions proposed in #1956 don't match the desired behavior in this thread. Any chance to reopen this?

lorinkoz avatar Nov 20 '17 22:11 lorinkoz

@oliviertassinari This request does not seem like a multi select one, But for long list allow user to type and filter from select list , So someone does not need to scroll a long list.

kavink avatar Jan 18 '18 01:01 kavink

hey, joining @kavink - looking for the same functionality

nlicht avatar Jan 24 '18 16:01 nlicht

@nlicht I have started using paypal/downshift instead for now. Unless you can afford to wait for this probably dead issue.

kavink avatar Jan 24 '18 19:01 kavink

This should be reopened as currently I don't see straight forward way of achiving it, however it's very common to want to filter the result set. Edit: Example of searching inside select lists: Kendo DropDownList

vladimirivanoviliev avatar Mar 07 '18 14:03 vladimirivanoviliev

@vladimirivanoviliev I believe some people have already been achieving such in the v1-beta.

oliviertassinari avatar Mar 07 '18 16:03 oliviertassinari

@vladimirivanoviliev can you please reference this? Looking at the v1-beta docs: https://material-ui.com/demos/selects/ I can't find this capability

nlicht avatar Mar 13 '18 10:03 nlicht

@oliviertassinari currently I can only see such functionality in the 'Native Select' component (which is having it as the native element supports it) - the regular one still does not have it.

Edit: Also as the v.1 is still in beta It would be nice to see this in the current (0.9xx) version of the components.

vladimirivanoviliev avatar Mar 19 '18 09:03 vladimirivanoviliev

Also as the v.1 is still in beta It would be nice to see this in the current (0.9xx) version of the components.

@vladimirivanoviliev What version are you referring to 0.9xx? We encourage the usage of the v1-beta version for new projects. The v0.x versions are in a legacy mode with low support.

oliviertassinari avatar Mar 19 '18 10:03 oliviertassinari

@oliviertassinari - the version I'm referring to is the current stable one v0.2x (sorry for the typo). The project was started when the v.1 was in early beta (and doesn't work well in our cases) which is why I decided to go with the previous official release. I will upgrade to it when it's released officially as my project is already in production (using betas is not an option for me).

vladimirivanoviliev avatar Mar 19 '18 11:03 vladimirivanoviliev

For people coming to this page looking for a searchable select field, please look into the material-ui AutoComplete component.

bityogi avatar Apr 17 '18 20:04 bityogi

@bityogi Autocomplete lets you write anything other than the options.

Use react select ( though) it's not material https://github.com/JedWatson/react-select

Hope somebody makes a material UI for react select

maibono avatar May 09 '18 08:05 maibono

This looks extremely promising: https://github.com/Sharlaan/material-ui-superselectfield

I have not yet had a chance to implement it, but from looking at the demo it's exactly what folks have been asking for, which is a way to filter a large list and make multiple selections.

semi-sentient avatar Jun 08 '18 15:06 semi-sentient

Is there any progress here?
Using non material-ui solutions brings a problem with the form validation (I'm using form validation specific for material ui components).

@semi-sentient It looks like that solution is still using 0.x version.

RudmanMario avatar Jun 08 '18 21:06 RudmanMario

I kinda mash together a TextField Menu + Popper, but it does not have keyboard support. Anyone find a solution that includes the keyboard?

ninjabunny avatar Sep 13 '18 23:09 ninjabunny

I made a small component you might wanna check out. https://github.com/DCCS-IT-Business-Solutions/react-searchable-select-mui Unfortunately there is no arrow-key Support (yet?) :)

mvitzthum avatar Sep 25 '19 08:09 mvitzthum

Would #17037 help?

oliviertassinari avatar Sep 25 '19 08:09 oliviertassinari

For people coming to this page looking for a searchable select field, please look into the material-ui AutoComplete component.

The Autocomplete is a very good one that fit my need. However you'll need to install Lab package npm install @material-ui/lab. Surely I can play around to even load new data while typing. And it does not select anything if you don't click on one or type it correctly. So it's a like a search, except the search input is no inside the list view, but on the input itself

KeitelDOG avatar Jan 27 '20 20:01 KeitelDOG