Skip to content

Feature request: search/filter in select #5697

Open

Description

@xuanshenbo

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

User able to search/filter the options in a select

What is the current behavior?

User must scroll the select to find the desired option

What is the use-case or motivation for changing an existing behavior?

When there is a long list of options, it's not easy to find an option

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Latest Angular Material as of 12 July 2017

Is there anything else we should know?

This is different from autocomplete, autocomplete is a free-text input field.

I haven't found anything in Material Design related to this, but this could be an important feature

Activity

  1. julianobrasil commented on Jul 12, 2017

    @julianobrasil
    Contributor

    @xuanshenbo, have you try a function to validate selection of the md-autocomplete at the (blur) event? I know it's not exactly the user experience that you're looking for, but I think it's a nice workaround: https://plnkr.co/edit/HzJNtcNLdctAbfeHbWCs?p=preview

  2. added
    feature
    on Jul 13, 2017
  3. jelbourn commented on Jul 13, 2017

    @jelbourn
    Contributor

    This is something we do plan on supporting eventually (similar to the md-select-header from AngularJS Material), but are still figuring out exactly how we want to implement it (the a11y is rather tricky).

  4. lightheaded commented on Aug 3, 2017

    @lightheaded

    This would be really useful, because currently md-select is veery poorly usable for long lists (e.g. country list) when compared to regular , because with the latter, you can hit the letter and jump to the items beginning with that letter. In md-select this is not an option and many developers are not willing to accept this as good UX in their applications :(

  5. deleted a comment from shyamal890 on Aug 17, 2017
  6. nekkon commented on Oct 30, 2017

    @nekkon

    Hey guys. Thanks for this great library of Material Components. Could you please add this feature in your roadmap? I believe it is important functionality, as most have already mentioned, and a must have in a long list. Also, it would be great if the filtering function could be defined by us (return true or false). @crisbeto @devversion @amcdnl @mmalerba @andrewseguin @jelbourn

  7. julianobrasil commented on Oct 30, 2017

    @julianobrasil
    Contributor

    @nekkon, it looks like it'll be possible soon: #7835

  8. jrood commented on Dec 6, 2017

    @jrood
    Contributor

    Indeed #7835 would be the way to implement search/filtering. @crisbeto is waiting for feedback before merging, so please give your feedback there if you have any.

  9. kylecordes commented on Dec 23, 2017

    @kylecordes

    I have implemented this capability as a wrapper around mat-autocomplete - and as a base class that can easily be reused to make visual variations. Repository and demo link below.

    https://github.com/OasisDigital/angular-material-obs-autocomplete

    https://oasisdigital.github.io/angular-material-obs-autocomplete/

    I am very interested in ideas in how I could reshape this work, in to the form of a component or similar thing to offer as a PR. Maybe the pair-of-functions that my solution uses, could be reshaped to something more like a mat-grid's DataSource ?

  10. macjohnny commented on Feb 12, 2018

    @macjohnny
    Contributor
  11. eyalhakim commented on Feb 12, 2018

    @eyalhakim

    @macjohnny this is great! However, it has a strange behavior when using the "multiple" attribute of the mat-select. When filtering and then selecting a value from the filtered list, it overrides and removes the previously selected values, which is not the desired behavior.

    Other then that it's great!

  12. macjohnny commented on Feb 13, 2018

    @macjohnny
    Contributor

    @eyalhakim Thanks for your feedback. I added an example with [multiple]=true and adapted the implementation of the mat-select-search to fix the behavior you described in #5697 (comment)

    when using the "multiple" attribute of the mat-select. When filtering and then selecting a value from the filtered list, it overrides and removes the previously selected values, which is not the desired behavior.

    so now it should also work correctly with [multiple]=true

  13. eyalhakim commented on Feb 13, 2018

    @eyalhakim

    @macjohnny works perfectly! thank you.

    I would also suggest using <mat-icon>close</mat-icon> for clearing the filter.

    Would appreciate if you release this as an npm package.

  14. 56 remaining items

  15. laviealon commented on Jan 17, 2024

    @laviealon

    Any update on this since 2018? This is such a fundamental feature I'm very surprised Angular has not taken care of this as it is an otherwise great framework.

    I will be using ngx-mat-select-search for the time being.

  16. aljazdolenc commented on Mar 31, 2024

    @aljazdolenc

    Any movement or plans to move this forward?

  17. lance2k commented on Apr 15, 2024

    @lance2k

    Same, will be using ngx-mat-select-search for the time being.

  18. jicedtea commented on Jul 8, 2024

    @jicedtea

    7 years... for a basic function. It's not hard to see why angular is so bad these days

  19. mehaxan commented on Dec 20, 2024

    @mehaxan

    7 years... for a basic function. It's not hard to see why angular is so bad these days

    not related to angular I guess. there's tons of libraries you can use in your project. Angular and Angular Material is not the same, right?

  20. JanProchy commented on Jan 9, 2025

    @JanProchy

    We would really love this. 🙏

  21. avicarpio commented on May 26, 2025

    @avicarpio

    Any news on this?

  22. saiyaff commented on Jun 16, 2025

    @saiyaff

    8 years and counting. This feature really needs some attention!

  23. eneajaho commented on Nov 20, 2025

    @eneajaho
    Contributor

    Not related to Material, but to Angular itself. There is now a supported way in Angular Aria for this feature
    https://angular.dev/guide/aria/combobox#dialog-popup

  24. XhstormR commented on Dec 17, 2025

    @XhstormR

    The autocomplete component should be used:
    https://angular.dev/guide/aria/autocomplete
    https://material.angular.dev/components/autocomplete/examples

    However, this is not an Angular Material component; we need to install an additional package, npm install @angular/aria and it doesn't have any styles.

  25. Keorl commented on Dec 17, 2025

    @Keorl

    Label : P3, important but not urgent. How many years can "but not urgent" justify ?

  26. JanProchy commented on Dec 19, 2025

    @JanProchy

    The autocomplete component should be used: https://angular.dev/guide/aria/autocomplete https://material.angular.dev/components/autocomplete/examples

    Well, autocomplete and searchable select box are not the same thing. Even if you use requireSelection there are still (subtle) differences in how the component is used.

  27. passee commented on Jan 13, 2026

    @passee

    Even if you use requireSelection there are still (subtle) differences in how the component is used.

    @JanProchy would you elaborate these subtle differences? I dont get the difference between a filterable mat select and an autocomplete with requireSelection, nor do I get the difference between the autocomplete and combobox mentioned in angular/aria

  28. JanProchy commented on Jan 13, 2026

    @JanProchy

    @passee sure, so lets take these sources as examples. Searchable select box is not provided by Anuglar Material so we will compare it with the ngx-mat-select-search and i modified the source values for angular autocomplete to be the same as for ngx-mat-select-search

    Now lets try these things in both controls:

    • type "united" and hit enter
      • in autocomplete nothing happend (you need to hit arrow down and then enter)
      • in select the only availabel value is selected
    • then lets say you want to change the value, so you click to the control again
      • in autocomplete you have the selected value as free editable string. So if you want to change the value, you need to clear it first (press and hold backspace, or select all and delete, etc..) and then start searching for the new value
      • in select you can start searching for the option imediately
    • then lets say during the searching for new option you changed your mind and you want to keep previous value
      • in autocomplete you leave the control (blur event) and the value is reseted to empty (no match between searched string and option list)
      • in select the previously selected value is back

    I think you could find much more of these subtle differences, which all comes from the fact, that autocomplete in core is a string input with some "hints" to help you, but select box is list of read-only values with a separate search field to filter them out.

  29. Andrew-Marks-Trisept commented on Jan 13, 2026

    @Andrew-Marks-Trisept

    ...autocomplete in core is a string input with some "hints" to help you, but select box is list of read-only values with a separate search field to filter them out.

    Great points -- I think this part is key. The way I see it:

    Autocomplete: Like an enhanced textbox. It accepts any string from the user, but has the ability to help them find a string they might want, or "finish typing" their string for them.

    Combobox: Like an enhanced dropdown box. It presents a set of valid options to the user, but has the ability to help them quickly find the one they want by typing (better than the native dropdown box does, anyway).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area: material/selectfeature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions