ValyroUI Русская версия

Search Input

Search field. Free, MIT · Forms and input › Text

Search field: icon, clear button, Escape to clear, Enter to search, optional debounce and ⌘K-style hotkey.

Installation

npx valyro-cli@latest add search-input
npx shadcn@latest add https://valyro.xyz/r/search-input.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { SearchInput } from 'valyro-ui';

Props

PropTypeDefault
valuestringControlled value; use with onValueChange.
defaultValuestringInitial value when uncontrolled.
onValueChange(value: string) => voidCalled as the text changes — after debounce ms of no typing when set; clearing is reported immediately.
debouncenumber0Quiet period before onValueChange fires, ms; 0 reports every keystroke.
onSearch(value: string) => voidCalled on Enter with the current text.
shortcutstringKeyboard hint shown in the field, e.g. "mod+k" (⌘K on Apple, Ctrl K elsewhere) or "/".
globalShortcutbooleanfalseAlso focus the field when shortcut is pressed anywhere on the page.
loadingbooleanfalseSwaps the search icon for a spinner and sets aria-busy on the input.
size'sm' | 'md' | 'lg'Field height and text size.
rightIconReactNodeIcon inside the field, after the text and the clear/password buttons.
invalidbooleanError border and aria-invalid on the input (an explicit aria-invalid wins).
labelsPartial<TextInputLabels>Accessible names of the clear and show/hide password buttons.

Related components

Previous: Textarea · Next: Mentions Input · All Forms and input