🎉 We are thrilled to introduce FastStore v2. If you are looking for documentation of the previous version of FastStore, please refer to FastStore v1.

Search Auto Complete

List of auto completing suggestions based on searched term. This component is part of the Search feature.

Import

Import the component from @faststore/ui

import { SearchAutoComplete, SearchAutoCompleteTerm } from '@faststore/ui'

Import Styles into your FastStore project

To apply the styles of this component in your FastStore project, import the following into your stylesheet:

@import '@faststore/ui/src/components/molecules/SearchAutoComplete/styles.scss'
  @import '@faststore/ui/src/components/atoms/Link/styles.scss';

Follow the instructions in the Importing FastStore UI component styles tutorial.


Usage


Props

Search Auto Complete

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-search-auto-complete

Search Auto Complete Term

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-search-auto-complete-term
linkPropsPartial<LinkProps<LinkElementType>>Props for the link from term component.
iconstring | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortalA React component that will be rendered as an icon.<Icon name="MagnifyingGlass" width={18} height={18} />
term*stringTerm researched.
suggestion*stringSuggestion proposed with auto complete.

Design Tokens

Local tokenDefault value/Global token linked
--fs-search-auto-complete-padding-topvar(--fs-spacing-2)
--fs-search-auto-complete-padding-rightvar(--fs-spacing-3)
--fs-search-auto-complete-padding-bottomvar(--fs-search-auto-complete-padding-top)
--fs-search-auto-complete-padding-leftvar(--fs-search-auto-complete-padding-right)
--fs-search-auto-complete-transition-propertyvar(--fs-transition-property)
--fs-search-auto-complete-transition-functionvar(--fs-transition-function)
--fs-search-auto-complete-transition-timingvar(--fs-transition-timing)

Nested Elements

Item

Local tokenDefault value/Global token linked
--fs-search-auto-complete-item-column-gapvar(--fs-spacing-1)
--fs-search-auto-complete-item-text-sizevar(--fs-text-size-2)
--fs-search-auto-complete-item-line-height1.25
--fs-search-auto-complete-item-bkg-color-hover
var(--fs-color-tertiary-bkg-hover)

Icon

Local tokenDefault value/Global token linked
--fs-search-auto-complete-item-icon-color
var(--fs-color-neutral-4)
--fs-search-auto-complete-item-icon-size1.125rem

Variants

Other Icons


Customization

For further customization, you can use the following data attributes:

data-fs-search-auto-complete

data-fs-search-auto-complete-item

data-fs-search-auto-complete-item-link

data-fs-search-auto-complete-item-icon