⚠️ After March 18, 2024, the FastStore documentation will be migrated to the Developer Portal. For more information, access the official release note.

Search Input Field

An InputField with a search button. This component is part of the Search feature.

Import

Import the component from @faststore/ui

import { SearchInputField } 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/SearchInputField/styles.scss';

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


Usage

<SearchInputField onSubmit={() => {}} />

Props

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-search-input
buttonPropsButtonPropsProps for the submit button inside the input.
buttonIconstring | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortalA React component that will be rendered as an icon (submit button).<Icon name="MagnifyingGlass" />
aria-labelstringCustom aria-label for input and button.
onSubmit*(value: string) => voidCallback function when submitted.

Design Tokens

Local tokenDefault value/Global token linked
--fs-search-input-field-height-mobilevar(--fs-control-tap-size)
--fs-search-input-field-height-desktopvar(--fs-spacing-6)
--fs-search-input-field-transition-timingvar(--fs-transition-timing)
--fs-search-input-field-transition-functionease

Nested Elements

Button

Local tokenDefault value/Global token linked
--fs-search-input-field-button-min-heightvar(--fs-search-input-height-desktop)
--fs-search-input-field-button-padding-top-desktopvar(--fs-spacing-0)
--fs-search-input-field-button-padding-bottom-desktopvar(--fs-search-input-field-button-padding-top-desktop)

Input

Local tokenDefault value/Global token linked
--fs-search-input-field-input-padding-rightvar(--fs-search-input-field-button-width)
--fs-search-input-field-input-bkg-color
var(--fs-color-body-bkg)

Customization

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

data-fs-search-input-field

data-fs-search-input-field-input