Skip to content

Base Typeahead

@astryxdesign/core v0.7.1 · BaseTypeahead

No selection

Usage ​

Composable combobox engine providing a bare input, search, keyboard navigation, and a styled result dropdown. It renders no input wrapper, border, or selected-value token. Typeahead and Tokenizer compose it for standard fields.

ts
import { BaseTypeahead } from '@astryx-vue/core/Typeahead'

The port keeps the same division of work. BaseTypeahead owns the input, the search source, the keyboard model, and the dropdown. The caller owns the field label, the description, the status message, and the selected-value token, and puts them around the engine. label here is only the input's accessible name, so omit it when an outside <label for> already names the input.

Anatomy

ElementDescription
InputBare combobox input. The caller supplies its visible field chrome and accessible name.
Loading statusNamed Spinner shown beside the input while an asynchronous source is pending, unless a composed owner takes over the busy indicator lane.
DropdownAnchored listbox surface containing current search or bootstrap results.
Empty stateDisabled listbox option shown after a completed search returns no results.
Result group headingVisible label for a group of result options.
Result rowOption wrapper that owns highlight, selection, pointer, and keyboard behavior.
Default item contentTypeaheadItem label and optional supporting content rendered inside a result row.
Caller-rendered item contentCaller content supplied through renderItem or item.element inside the stable result row.
Selected result stateSelected row weight and trailing check shown when a result matches value.

Best practices ​

GuidancePractice
DoUse Typeahead or Tokenizer for standard fields; they wrap BaseTypeahead with input chrome and selected-value rendering it intentionally omits.
DoProvide your own visible label or aria-label and custom input wrapper so the bare combobox has an accessible name, focus treatment, border, and layout.
DoPass anchorRef pointing to your wrapper so the dropdown positions against your custom input chrome, not just the bare input element.
AvoidExpect input chrome or selected-value rendering. BaseTypeahead is an engine; the caller owns those visible parts.
AvoidUse BaseTypeahead when Typeahead or Tokenizer would suffice; the extra wrapper and styling work is only justified for truly custom compositions.
AvoidTreat Escape as cancellation of pending source work. It hides the current popup, but a late response can reopen it.

Examples ​

Common configurations, variations, and states.

BaseTypeahead

A custom result renderer that adds supporting metadata while BaseTypeahead retains option semantics and keyboard behavior.