Base Typeahead
@astryxdesign/core v0.7.1 · BaseTypeahead
Props
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue | T | null | null | Currently selected item. An empty value means nothing is selected yet. |
searchSource | SearchSource<T> | — | Static or async source with search and optional bootstrap. Required. |
label | string | — | Accessible name of the input. Omit it when an outside <label for> already names the input. |
inputId | string | generated | Id of the input, so an outside label can point at it. |
describedBy | string | — | Ids of the description and status the caller already computed. |
ariaDescribedBy | string | — | Input-specific alias for aria-describedby. Takes precedence over the native attribute. |
ariaLabelledBy | string | — | Input-specific alias for aria-labelledby. Takes precedence over the native attribute. |
anchorRef | HTMLElement | null | — | Element the dropdown hangs from and measures itself against. Defaults to the input's own wrapper. |
placeholder | string | Search… | Placeholder text, shown while nothing is selected. |
disabled | boolean | false | Disables the input. |
disabledReason | string | — | Why the input is disabled, shown as a tooltip and announced as the description while the input stays focusable. |
isFocusableDisabled | boolean | false | Keeps a disabled input focusable through aria-disabled and readonly so a caller-owned disabled reason stays discoverable. Text entry stays blocked. |
status | 'default' | 'success' | 'warning' | 'error' | 'default' | Border color of the control. The message itself belongs to the caller's field. |
size | 'sm' | 'md' | 'lg' | 'md' | Size of the input and of the dropdown rows. |
clearable | boolean | false | Shows a clear button. |
debounceMs | number | 150 | Wait after typing before searching. Use 0 for local data. |
maxMenuItems | number | 10 | Maximum rows in the dropdown. |
menuWidth | number | — | Requested dropdown width in pixels. Never narrower than the anchor, and clamped to the viewport. |
minQueryLength | number | 1 | Shortest query that gets searched, counted in visible characters. Below it nothing is searched and the menu stays closed. |
showOnFocus | boolean | false | Shows bootstrap results on focus before typing. Legacy name of hasEntriesOnFocus; either one turns it on. |
hasEntriesOnFocus | boolean | false | Shows bootstrap results on focus before typing. |
hasAutoFocus | boolean | false | Focuses the input on mount. |
emptyText | string | null | — | Text shown when the source has nothing at all. |
emptySearchText | string | null | localized “No results found” | Text shown when the query matched nothing. null counts as not given and falls through to the default; pass an empty string to render nothing. |
required | boolean | false | Marks the input as required. |
name | string | — | Form field name. Submits the selected item's id. |
inputTabIndex | number | — | Tab order of the input. |
Events
update:modelValue(value: T | null)/change(value: T | null): the selection was set or cleared.search(query: string)/changeQuery(query: string): the query text changed. Both fire;searchis the legacy name.openChange(isOpen: boolean): the dropdown opened or closed.
Native attributes and listeners that are not listed above land on the input element, so @keydown, @focus, @blur, and aria-* work as they would on a plain <input>. A keydown listener runs before the internal keyboard navigation; call event.preventDefault() to skip it.
Slots
icon: artwork at the start of the input. The wrapper is hidden from assistive technology.item: replaces the default row, and receivesitem,isActive, andisSelected. The row wrapper that owns highlight, selection, pointer, and keyboard behavior stays.empty: replaces the no-results content.