Skip to main content

Configure the following properties on the searchField component.

Configure the following properties on the search field component.

Anchor to disabled
disabled
boolean
Default: false

Disables the field, disallowing any interaction.

string

A unique identifier for the element.

Anchor to placeholder
placeholder
string

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

Anchor to value
value
string

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


The searchField component provides event callbacks for handling user interactions. Learn more about handling events.

The search field component provides event callbacks for handling user interactions. Learn more about handling events.

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

Callback when the field loses focus.

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

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

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

Callback when the field is focused.

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

Callback when the user changes the value in the field.


Examples

Enable search with a search field

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

Preview

Enable search functionality using a searchField component. This example shows a basic search field with placeholder text.

  • Use for inline search and filtering: Choose searchField for filtering within specific sections or lists, not for global navigation or complex multi-step searches.
  • Follow placeholder pattern: Use "Search {items}" format like "Search products" or "Search customers" to clarify scope.
  • Choose the right event: Use input for real-time filtering as users type. Use change for expensive operations that should wait until typing completes.
  • Handle empty values: When the field is cleared, reset filters or show all items appropriately.

Was this page helpful?