Menu
Guides
Storefront Development

Storefront Development

SearchAutoComplete

List of auto completing suggestions based on searched term.

1 min read
List of auto completing suggestions based on searched term. This component is part of the Search feature.
Example
Code
Searching for: Appl
  1. apple airpods

  2. apple tv

Usage

Import the component


_10
import { SearchAutoComplete, SearchAutoCompleteTerm } from "@faststore/ui";

Import styles

To apply styles, include the following in your stylesheet:

_10
@import "@faststore/ui/src/components/molecules/SearchAutoComplete/styles.scss";


Examples

Other Icons

Example
Code

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)

Design tokens: 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)

Design tokens: 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

Data attributes

You can target and override SearchAutoComplete styles using 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

Props

SearchAutoComplete

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

SearchAutoCompleteTerm

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.