Skip to content
Forms

Search Field

A text input with a search icon, clearable value, and optional keyboard shortcut hint.

Import

import { SearchField } from "@mikenotthepope/substrateui"

Labels

The clear button is an icon with no text, and the placeholder is the field's only visible hint. Override one instance with the labels prop on the component, or every instance at once through LabelsProvider's searchField key — the provider is how you translate the set once instead of at each call site.

PropTypeDefaultDescription
placeholderstring"Search..."Placeholder text. Not a label — pair the field with a real one.
clearSearchstring"Clear search"Accessible name for the clear button.

API Reference

PropTypeDefaultDescription
value
required
stringThe controlled value of the search field.
onChange
required
(value: string) => voidCallback fired when the input value changes.
placeholderstring"Search..."Placeholder text shown when the field is empty.
shortcutstringOptional keyboard shortcut label displayed when empty.
onClear() => voidOptional callback fired when the clear button is clicked.
classNamestringAdditional CSS classes.