Skip to main content
Autocomplete is also available as an experimental widget in InstantSearch, making it easier to integrate into your search experience. For more information, see the API reference for InstantSearch.js or React InstantSearch.

Index setup

Before using the query suggestions plugin, you need to create an Algolia with the expected format. You can either use the dashboard, or use the API clients.

Installation

First, you need to install the plugin.
Then import it in your project:
JavaScript
If you don’t use a package manager, you can use the HTML script element:
HTML

Example

This example uses the plugin within autocomplete-js, along with the algoliasearch API client.
JavaScript
Combine this plugin with the recent searches plugin, as follows:
JavaScript
To see it in action, check this demo on CodeSandbox.

Parameters

SearchClient
required
The initialized Algolia search client.
string
required
The index name.
(params: { state: AutocompleteState }) => SearchParameters
A function returning Algolia search parameters.
(params: { source: AutocompleteSource, state: AutocompleteState, onTapAhead: () => void })
This function takes the original source as a parameter and returns a modified version of that source.Example: change Autocomplete stateUsually, when a link in the Autocomplete menu is selected, the menu closes. However, to keep the menu visible after a selection is made, use transformSource to set the isOpen state:
JavaScript
Example: create linksTurns Query Suggestions into clickable Google search links:
string | string[]
The attribute or attribute path to display categories for.
JavaScript
number
default:1
How many items to display categories for.
number
default:1
The number of categories to display per item.
Last modified on May 19, 2026