Prism Docs

AutoComplete

Basic Usage

The simplest usage of AutoComplete with static options.

Selected: None

<prism-autocomplete [(value)]="basicValue" [options]="options" />

Custom Filter

Using a custom filter function (e.g., 'Starts with' instead of default 'Contains').

<prism-autocomplete 
  [(value)]="customValue" 
  [options]="options" 
  [filterFn]="customFilter" 
  placeholder="Starts with..." />

Async Search

Handle asynchronous data loading with the searchChange event.

<prism-autocomplete 
  [(value)]="asyncValue" 
  [options]="options" 
  [isLoading]="isLoading()"
  (searchChange)="onSearchChange($event)" />

PrismAutoComplete API

NameTypeDefaultDescription
optionsinput<string[]>[]List of suggestions.
valuemodel<string>''The current value of the input.
placeholderinput<string>'Type to search...'Input placeholder.
disabledinput<boolean>falseWhether the input is disabled.
allowFreeTextinput<boolean>trueWhether to allow values not in the options list.
maxResultsinput<number>10Maximum number of results to display.
isLoadinginput<boolean>falseDisplay a loading spinner.
filterFninput<((q: string, opts: string[]) => string[]) | null>nullCustom filter logic.
selectedoutput<string>-Emitted when an option is selected.
searchChangeoutput<string>-Emitted on every keystroke.