Components › Forms

Search field

A search input with a clear button, a focus shortcut and a loading state. Escape clears it.

Installation

npx plankui@latest add search-field

Usage

import { SearchField } from "@/components/ui/search-field";

<SearchField value={query} onValueChange={setQuery} shortcut="/" />

API reference

PropTypeDefaultDescription
value / defaultValuestring""Controlled or initial text.
onValueChange(value: string) => voidCalled on every change, and with an empty string on clear.
shortcutstringA key that focuses the field from anywhere, shown as a hint while empty.
loadingbooleanfalseSwaps the search icon for a spinner.
size"sm" | "md" | "lg""md"Height.

View the source on GitHub