Documentation
Feedback
Guides
Storefront Development

Storefront Development
Storefront development
SearchHistory

Shows the latest terms searched by a user.

Responsible for showing the latest terms searched by a user. This component is part of the Search feature.
Example
Code

History

  1. Headphone
  2. Audio & Video
  3. mh-7000

Usage

Import the component


_10
import { SearchHistory, SearchHistoryTerm } from "@faststore/ui";

Import styles

To apply styles, include the following in your stylesheet:

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


Examples

Other Icons

Example
Code

History

  1. Headphone
  2. Audio & Video

Design tokens

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

Design tokens: Header

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

Design tokens: Title

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

Design tokens: Item

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

Design tokens: Icon

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

Data attributes

You can target and override SearchHistory styles using the following data attributes:
data-fs-search-history
data-fs-search-history-header
data-fs-search-history-title
data-fs-search-history-item
data-fs-search-history-item-link
data-fs-search-history-item-icon

Props

SearchHistory

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-search-history
titlestringTitle attribute for the <section> tag rendered by this component.History
clearLabelstringDefines the text displayed in clear history button.Clear History
onClear() => voidEvent handler for click on clear history button.

SearchHistoryTerm

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-search-history-term
value*stringDefines the text displayed in history term item.
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="ClockClockwise" width={18} height={18} />
Contributors
3
Photo of the contributor
Photo of the contributor
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
3
Photo of the contributor
Photo of the contributor
Photo of the contributor
On this page