Documentation
Feedback
Guides
Storefront Development

Storefront Development
Search Top

This section displays the most searched terms by customers.

This section displays the most searched terms by customers. This component is part of the Search feature.

Import

Import the component from @faststore/ui

_10
import { SearchTop, SearchTopTerm } 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:

_10
@import '@faststore/ui/src/components/molecules/SearchTop/styles.scss';

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

Usage


_10
<SearchTop title="Top Search">
_10
<SearchTopTerm value="Notebooks" linkProps={{ href: '#' }} index={0} />
_10
<SearchTopTerm value="Laser Printer" linkProps={{ href: '#' }} index={1} />
_10
<SearchTopTerm
_10
value="Bluetooth Keyboard"
_10
linkProps={{ href: '#' }}
_10
index={2}
_10
/>
_10
</SearchTop>


Props

Search Top

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-top-search
titlestringTitle attribute for the <section> tag rendered by this component.Top Search

Search Top Term

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-top-search-term
value*stringSearch term to be shown.
linkPropsPartial<LinkProps<LinkElementType>>Props for the `<Link>` rendered by this component.
index*numberCurrent term's position in a list of search terms.

Design Tokens

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

Nested Elements

Header

Local tokenDefault value/Global token linked
--fs-search-top-header-padding-topvar(--fs-spacing-1)
--fs-search-top-header-padding-bottomvar(--fs-search-top-header-padding-top)

Title

Local tokenDefault value/Global token linked
--fs-search-top-title-sizevar(--fs-text-size-lead)
--fs-search-top-title-line-height1.5

Item

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

Customization

For further customization, you can use the following data attributes:
data-fs-search-top
data-fs-search-top-header
data-fs-search-top-title
data-fs-search-top-item
data-fs-search-top-item-link
data-fs-search-top-item-badge
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
Was this helpful?
Yes
No
Suggest edits (Github)
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
On this page