Skip to content

Search Field

Free

A search field with a key to focus it (/ or ⌘K), a clear button, and a spinner while results load. Escape clears it, and it waits for a pause in typing.

  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Import Search Field and compose its parts.

search-field.tsx

SearchField

<div>
PropTypeDefaultDescription
rounded"default""full""default"
size"default""lg""sm""xs""default"
variant"dashed""default""default"
valuestring—The text, when the parent owns it.
defaultValuestring—The first text, when the field owns it. Default "".
onValueChange—Each change of the text, at once (each key, a clear).
onSearch—Run the search: on Enter, on a clear (with ""), and after debounce ms of no typing.
onClear—The text was cleared (the clear button, or Escape with text).
debouncenumber—Ms of no typing before onSearch runs. undefined (the default): typing does not search, only Enter and a clear do. 0: each change searches.
shortcutfalse"/""mod+k"falseThe key that focuses and selects the field from anywhere. Default false (none).
classNamestring—Classes of the frame (the InputGroup), for its width.
busybooleanfalseThe field waits for results: the spinner takes the place of the search icon, and the input is aria-busy.
labels—The words (SEARCH_FIELD_LABELS). Keep the object stable.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use it above a list or a table.
  • Set shortcut to focus it from anywhere.
  • Set debounce to run onSearch after typing stops.
  • For a list of choices in a popup, use a Combobox.
  • For a plain text field, use an Input.
EscapeClears the text.
EnterRuns onSearch at once.
/orMod KMoves the focus to the field, when you set shortcut.

It is a real input with the search role.

The clear button has a name, and it comes from labels.

Clear
fade · 150ms · the clear button shows when there is text

Built with

Installs with Search Field

  1. AddedSearch Field, with Input Group, Kbd, Spinner.
Open the release