Search | SearchField
SearchField#
Description#
- The system search field component. Inside it is the system’s
TextInput, with integrated magnifier, clear button, and loading spinner. Two distinct events:update:modelValue(the text, on every keystroke) andsearch(“search for real”, with Enter or after the debounce).
Props#
modelValue(string) — The field text (withv-model). Default:''.placeholder(string) — Helper text when the field is empty.label(string) — What a screen reader hears; the field has no visible label. Default:''.disabled(boolean) — Disables the field. Default:false.autofocus(boolean) — Requests focus on mount, for search that opens in a menu or panel. Default:false.debounce(number) — Milliseconds to wait after the last keystroke before emittingsearch. At0,searchonly fires with Enter. Default:0.clearable(boolean) — Shows the clear button. Default:true.busy(boolean) — Swaps the magnifier for a loading spinner: the search is working. Default:false.listboxId(string) — Theidof the list this field drives, if it drives one. Turns the field into acomboboxpattern.activeOptionId(string) — Theidof the highlighted option in that list, to announce it without moving focus.expanded(boolean) — Whether the list is expanded.clearLabel(string) — What is heard on the clear button; if absent, comes from the catalog (search.clear). Default:''.size('md'|'lg') —lgis the 40 px field for search that is the window. Default:'md'.bare(boolean) — Without border or background, for when it already sits on a surface that frames it. Default:false.autocomplete(string) — Theautocompleteof theinput(for example,off). Default:undefined.spellcheck(boolean) — The engine’s spell check. Default:undefined.
Emits#
update:modelValue(string) — The text, on every keystroke.search(string) — “Search for real”: with Enter, or on its own when the debounce elapses.clear— When the field is emptied with the clear button.keydown(KeyboardEvent) — Forwards keystrokes so the consumer can handle its own (Escape, arrows, etc.).
Usage#
| |
Notes#
- Enter cancels the pending debounce and searches right away.
- Clearing with the button emits
update:modelValue(''),clear, andsearch(''), in that order. - Exposes the
focus()method (and its obsolete aliasenfocar()) to restore focus without touching the DOM.