Skip to main content
This is the React InstantSearch v7 documentation. If you’re upgrading from v6, see the upgrade guide. If you were using React InstantSearch Hooks, this v7 documentation applies—just check for necessary changes. To continue using v6, you can find the archived documentation.
Use Query Suggestions to help users find popular searches as they type. Query Suggestions creates an from popular searches. You can use this index to show search suggestions. After you configure the Query Suggestions index, use the <Autocomplete> widget to show suggestions. When users select a suggestion, the widget navigates to the suggestion URL or refines the search query, depending on your configuration.

Open CodeSandbox

Run and edit the Query Suggestions UI example in CodeSandbox.

Explore source code

Browse the source code for the Query Suggestions UI example on GitHub.
This widget is and is subject to change in minor versions.

Add Query Suggestions and recent searches

The widget displays suggestions from a Query Suggestions index and recent searches stored in the browser’s local storage. Enable them with the showQuerySuggestions and showRecent props:
React

Refine results with suggestions

To keep users on the same page, set up a multi-index search experience that uses the selected suggestion to search the main index. The <Autocomplete> widget targets the index that contains the suggestions. The other widgets target the main index that contains your records. For more information, see Multi-index search.
React

Customize recent searches

Pass an object to showRecent to customize how each recent search renders:
React

Customize suggestions

Add an itemComponent to showQuerySuggestions to template each suggestion, and searchParameters to apply search parameters to the suggestions query:
React
Use <ReverseHighlight> to emphasize the text that doesn’t match the query. This is a common style for Query Suggestions. The widget has no built-in category grouping for suggestions and there’s no categoryAttribute. To show a category next to a suggestion, render the category in the suggestion’s item template.

See also

Last modified on July 21, 2026