Skip to main content

Common Examples

import { SearchField } from "@servicetitan/anvil2";

function ExampleComponent() {
  return <SearchField />;
}

Controlling search inputs

The value of search inputs are uncontrolled by default. To control a search input, use the value prop.

Uncontrolled

Controlled

Form Example

The SearchField component uses an HTML input and so can be used within an HTML form the same way that a regular HTML input element can.

React Accessibility

Add aria-label or aria-labelledby so that screen readers can properly announce what this is searching.For more guidance on form field labels and context, see input field context association best practices.
Last modified on January 23, 2026