Skip to main content

SearchField

Captures search terms from merchants using a single-line input field. Includes visual styling to indicate search functionality, and an accessory to quickly clear the input.

boolean
Default: false

Disables the field, disallowing any interaction.

string

A unique identifier for the element.

string

A short hint that describes the expected value of the field.

string

The current value for the field. If omitted, the field will be empty.

Was this section helpful?

Learn more about registering events

(event: <"s-search-field">) => void

Callback when the field loses focus.

(event: <"s-search-field">) => void

Callback when the field loses focus after the user changes the value in the field.

(event: <"s-search-field">) => void

Callback when the field is focused.

(event: <"s-search-field">) => void

Callback when the user changes the value in the field.

Was this section helpful?

Code

<s-search-field placeholder="Search" />

Preview

SearchField usage patterns

Handle search input events

Was this section helpful?

Event handling

<s-search-field
placeholder="Search products..."
value=""
onInput={(event) => console.log('Input:', event.target.value)}
onChange={(event) => console.log('Change:', event.target.value)}
onFocus={(event) => console.log('Search focused')}
onBlur={(event) => console.log('Search blurred')}
/>