Skip to content

Base Typeahead

@astryxdesign/core v0.7.1 · BaseTypeahead

Props ​

PropTypeDefaultDescription
modelValueT | nullnullCurrently selected item. An empty value means nothing is selected yet.
searchSourceSearchSource<T>—Static or async source with search and optional bootstrap. Required.
labelstring—Accessible name of the input. Omit it when an outside <label for> already names the input.
inputIdstringgeneratedId of the input, so an outside label can point at it.
describedBystring—Ids of the description and status the caller already computed.
ariaDescribedBystring—Input-specific alias for aria-describedby. Takes precedence over the native attribute.
ariaLabelledBystring—Input-specific alias for aria-labelledby. Takes precedence over the native attribute.
anchorRefHTMLElement | null—Element the dropdown hangs from and measures itself against. Defaults to the input's own wrapper.
placeholderstringSearch…Placeholder text, shown while nothing is selected.
disabledbooleanfalseDisables the input.
disabledReasonstring—Why the input is disabled, shown as a tooltip and announced as the description while the input stays focusable.
isFocusableDisabledbooleanfalseKeeps 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.
clearablebooleanfalseShows a clear button.
debounceMsnumber150Wait after typing before searching. Use 0 for local data.
maxMenuItemsnumber10Maximum rows in the dropdown.
menuWidthnumber—Requested dropdown width in pixels. Never narrower than the anchor, and clamped to the viewport.
minQueryLengthnumber1Shortest query that gets searched, counted in visible characters. Below it nothing is searched and the menu stays closed.
showOnFocusbooleanfalseShows bootstrap results on focus before typing. Legacy name of hasEntriesOnFocus; either one turns it on.
hasEntriesOnFocusbooleanfalseShows bootstrap results on focus before typing.
hasAutoFocusbooleanfalseFocuses the input on mount.
emptyTextstring | null—Text shown when the source has nothing at all.
emptySearchTextstring | nulllocalized “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.
requiredbooleanfalseMarks the input as required.
namestring—Form field name. Submits the selected item's id.
inputTabIndexnumber—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; search is 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 receives item, isActive, and isSelected. The row wrapper that owns highlight, selection, pointer, and keyboard behavior stays.
  • empty: replaces the no-results content.