Skip to content

[material-ui] [Autocomplete] Add disableSearch to prevent local search #45512

Open
@yermartee

Description

@yermartee

Summary

Hi there,

The Autocomplete component currently lacks the ability to disable its built-in local search functionality.

This behavior becomes problematic in scenarios where backend APIs handle all search and filtering, as it leads to unnecessary processing and potential data discrepancies.

To address this, I suggest introducing a new disableSearch prop. When set to true, this prop would completely prevent the component from performing any local search, allowing developers to rely entirely on backend-driven search and filtering logic.

This feature would improve performance, ensure data consistency, and provide a more elegant solution compared to workarounds like overriding filterOptions.

Examples

Scenario:

  • The Autocomplete component has a built-in local search that filters results based on user input.
  • The backend API already handles search and filtering with a custom logic (e.g., fuzzy search, partial matches, or case-insensitive search).
  • The response from the backend is already filtered, but the Autocomplete component re-filters the results locally, causing issues.

Motivation

I suggest a new feature for the Autocomplete component: the ability to fully disable local search.

By implementing full support for disableSearch: true, developers can rely entirely on backend search and filtering, improving both performance and data consistency.

Currently, I’m addressing this issue by using:

filterOptions={(options) => options} // No need to filter options; we handle it on the server

However, I believe a more elegant solution would be to introduce a dedicated disableSearch prop.
I’d be happy to open a PR to implement this feature.

Search keywords: Autocomplete, LocalSearch, Input

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions