Skip to main content
Signature

Import

To ensure optimal bundle sizes, see Optimize build size.
Vue

See this widget in action

Preview this widget and its behavior.

About this widget

The ais-autocomplete widget provides the logic to create a connected component that provides access to all indices of your InstantSearch instance. The Autocomplete UI library lets you build a full-featured, accessible search experience. See also: Integrate Autocomplete with Vue InstantSearch

Examples

Vue

Props

boolean
default:true
Whether to escape HTML entities from hits string values.
Vue
Whether the widget makes InstantSearch require a main search request. By default (true), the widget contributes to the main search. Set it to false to opt the widget out of the main search: if it’s the only widget on the page, InstantSearch doesn’t send a main search request.
Vue
object
default:"{}"
The CSS classes you can override:
  • ais-Autocomplete. The container of the widget.
Vue

Customize the UI

The slot to override the complete DOM output of the widget.If you use this slot, the other slots don’t change the output, because the default slot surrounds them.Scope
  • currentRefinement: string. The current value of the query.
  • indices: object[]. The list of indices.
  • refine: (string) => void. The function to change the query.
The indices contain their hits and results, and the main in first position. You can use the highlighting feature through the highlight widget (see below). Each index includes:
  • indexName: string. The name of the index.
  • indexId: string. The id of the index.
  • hits: object[]. The resolved hits from the index matching the query.
  • results: object. The full results object from the Algolia API.
  • sendEvent: (eventType, hit, eventName) => void. The function to send click or conversion events. The view event is automatically sent when the connector renders hits. You can learn more about the insights middleware.
    • eventType: 'click' | 'conversion'
    • hit: Hit | Hit[]
    • eventName: string
Vue

Prebuilt autocomplete component

The ais-experimental-autocomplete component renders a complete autocomplete menu: a search box, a panel with results from one or more indices, recent searches, Query Suggestions, prompt suggestions, and a detached layout for small screens. It uses the same markup and most of the same options as the InstantSearch.js autocomplete widget, so see that page for details about each option. The JavaScript container and templates options don’t apply: Vue renders the component in place, and slots replace templates. Use class-names for cssClasses and get-search-page-url for getSearchPageURL.
The component is experimental: its name and API may change in a later version.
Vue
Vue
The component runs autocomplete searches separately from the main search. It starts searching when users focus the search box, or on page load if autofocus is true. The component reads its props only when initialized. Changing them later doesn’t have any effect.

Props

  • indices and feeds are mutually exclusive. Setting both throws an error. feeds requires a composition-based InstantSearch instance with compositionID set.
  • show-prompt-suggestions and ai-mode send the query to an ais-chat widget in the same index.
  • Write escapeHTML in camelCase. The kebab-case form escape-html doesn’t bind.
  • class-names uses the keys of the InstantSearch.js cssClasses option, such as root, panel, and panelOpen, not ais- class names.

Slots

Last modified on October 28, 2026