Documentation
Feedback
Guides
VTEX IO Apps

VTEX IO Apps
Autocomplete Result List
vtex.store-components
Version: 3.151.2
Latest version: 3.178.2

This page is about version 3.151.2 of the app, which is not the most recent version. The latest stable version is 3.178.2.

autocomplete-result-list is a VTEX Component that represents the autocomplete from the search bar. This components serves mostly to ease the creation of custom autocomplete components by search engines.

Configuration

  1. Import the vtex.store-components app to your theme's dependencies in the manifest.json, for example:

_10
dependencies: {
_10
"vtex.store-components": "3.x"
_10
}

  1. Add the autocomplete-result-list block into the search-bar blocks, for example:

_10
"search-bar": {
_10
"blocks": ["autocomplete-result-list"]
_10
}

JavaScript API (advanced)

This autocomplete is commonly used with Downshift. Some of its props are directly related to it.

Prop nameTypeDescriptionDefault value
dataObjectGraphql data response{}
inputValueStringSearch query-
onClearInputFunctionClears the input-
getItemProps (Downshift)FunctionReturns the props you should apply to any menu item elements you render-
closeMenu (Downshift)Functioncloses the menu-
highlightedIndex (Downshift)NumberThe index that should be highlighted-
getMenuProps (Downshift)Functionreturns the props you should apply to the ul element (or root of your menu) that you render-
customSearchPageUrlStringTemplate for a custom url. It can have a substring ${term} used as placeholder to interpolate the searched term. (e.g. /search?query=${term})-
isOpenBooleanIdentify if autocomplete should be open-
attemptPageTypeSearchBooleanif true, uses the term the user has inputted to try to navigate to the proper page type (e.g. a department, a brand, a category)-
classesCustomCSSClassesUsed to override default CSS handles. To better understand how this prop works, we recommend reading about it here. Note that this is only useful if you're using this block as a React component.undefined

Customization

In order to apply CSS customizations in this and other blocks, follow the instructions given in the recipe on Using CSS Handles for store customization.

CSS Handles
resultsItem
resultsList
searchTerm
resultsItemImage
spinnerContainer
spinnerInnerContainer
resultsItemName
See also
Vtex.store Components
VTEX IO Apps
VTEX App Store
VTEX IO Apps