Inputs · SearchInputstable
Search input
Lets users find items by typing a keyword, inside a role=search form. Live or submit-only search, a clear button, loading and a shortcut hint.
Preview
#previewSwitch size and state. The React and CSS tabs update with the preview.
size medium · shortcut="/" · debounced onChange
payment-search.tsx
import { SearchInput } from "@blade-ai/weft/components/search-input";
export function PaymentSearch({ query, results, onSearch }: Props) {
return (
<SearchInput
label="Search payments"
placeholder="Search payments, customers or IDs"
size="medium"
shortcut="/"
defaultValue={query}
onChange={onSearch} // debounced 300ms
onSubmit={onSearch}
resultCount={results.length}
/>
);
}All states
#all-statesEvery state from the Search Input states table, shown at size medium.
Empty
Typing
Filled
Hover
Focus-visible
Disabled
Read-only
Loading
Invalid
Shortcut hint
Small
Large
Props
#propsBooleans are is-prefixed. label is required. onChange and onSubmit receive the query string.
Prop
Type
Default
Description
label *
string
—
Accessible name. Shown when labelPosition is set, otherwise rendered as aria-label.
labelPosition
"top" | "left"
—
Visible label above or to the left. Omit in toolbars.
placeholder
string
"Search"
Names what can be searched.
value · defaultValue
string
""""
Query, controlled or uncontrolled. Kept after searching so users can refine it.
searchOn
"change" | "submit"
"change"
Live (debounced onChange) vs Enter only.
debounceMs
number
300
Delay before onChange fires in live mode.
minQueryLength
number
—
Characters before onChange / onSubmit fire. UNDEFINED · needs decision; no minimum until decided.
onChange
(value: string) => void
—
Debounced; not called below minQueryLength. Clear calls it with "" immediately.
onSubmit
(value: string) => void
—
Enter; flushes a pending debounce.
onClear
() => void
—
Clear button or Esc; value becomes "" and focus returns to the input.
isLoading
boolean
false
Spinner replaces the clear button; the form is aria-busy. Editable while loading: UNDEFINED · needs decision (stays editable).
isSearchIconVisible
boolean
true
Leading search icon.
shortcut
string | null
—
Global key that focuses the input; shown as a hint while empty and not focused.
resultCount
number
—
Text for the polite live region ("12 results", "No results for …").
size
"small" | "medium" | "large"
"medium"
Height 32 / 36 / 48px.
isDisabled
boolean
false
disabled attribute; clear and hint hidden.
isReadOnly
boolean
false
readonly attribute; no clear.
isInvalid · errorText
boolean · string
"false · —"
aria-invalid + describedby. Trigger and copy: UNDEFINED · needs decision.
autoFocus · name · testID
boolean · string · string
—
Passed to <input>.
Usage
#usageShort rules for search fields.
Do
Place the search at the start of the toolbar above what it searches.
Say what can be searched: "Search payments, customers or IDs".
Always give an accessible name; the field is wrapped in role="search".
Show a result for every search: rows, loading or an Empty State with a way out.
Don't
Add two search fields for the same content.
Rely on the placeholder as the only label.
Leave a blank area after a search.
Show the native WebKit clear next to ours, or the "/" hint on touch.
Accessibility
#accessibilityNative search input in a role=search landmark, plus the clear button and the shortcut.
Keyboard
Key
Action
/
Focuses the search from anywhere (not inside text fields) when shortcut="/".
Enter
Submits the search (onSubmit).
Esc
Clears the query (first press) or leaves the field.
Tab
Field → clear button (when shown) → next element.
Enter / Space on clear
Clears and returns focus to the input.
ARIA
Element
Role / attribute
When
<form> container
role="search" (landmark)
Always
<input>
type="search" · autocomplete="off"
Always; native cancel button hidden
<input>
aria-label = label
No visible label (labelPosition unset)
<label>
htmlFor → input id
labelPosition is set
Clear <button>
type="button" · aria-label="Clear search"
value ≠ ""
Live region
role="status" · aria-live="polite" · visually hidden
resultCount is set
Spinner · form
spinner aria-hidden · form aria-busy="true"
isLoading
Shortcut hint
aria-hidden · input aria-keyshortcuts="/"
shortcut set
<input>
aria-invalid="true" · aria-describedby → message
isInvalid
Agent Spec
#agent-specMachine-readable spec, tables (a)–(g). Same source as /specs/search-input.json and llms.txt.
PropertyValueToken
Height32 / 36 / 48pxsize.32 · size.36 · size.48 (Blade: 40 large)
Padding-x8 / 12 / 12pxspacing.3 · spacing.4
Gap6 / 8 / 8pxspacing.15 · spacing.3
Search icon14 / 16 / 16pxsize.14 · size.16
Clear · spinner14px all sizessize.14; hit target: UNDEFINED · needs decision
Query font13 / 13 / 14pxfonts.size.1200 · fonts.size.100 · lineHeights.100
Shortcut hintmono, 13pxfonts.family.code · fonts.size.1200
Border · ring · radius1px · 3px · 0border.width.thin · interactive.border.primary.faded + border.width.3 · border.radius.none