Interface AutocompleteConfig<State>

interface AutocompleteConfig<State> {
    dropdownSelector: Selector | ((input: HTMLInputElement) => Selector);
    fetch: InputSearchQueryWithFields | ((input: string) => PromiseLike<State>);
    googleAnalytics?: boolean | GoogleAnalyticsConfig;
    historyEnabled?: boolean;
    historySize?: number;
    inputSelector: Selector;
    minQueryLength?: number;
    nostoAnalytics?: boolean;
    render: ((container: HTMLElement, state: State) => void | PromiseLike<void>);
    submit?: ((query: string, config: AutocompleteConfig<State>, options?: SearchAutocompleteOptions) => void);
}

Type Parameters

  • State

Properties

dropdownSelector: Selector | ((input: HTMLInputElement) => Selector)

The dropdown element to attach the autocomplete to

fetch: InputSearchQueryWithFields | ((input: string) => PromiseLike<State>)

The function to use to fetch the search state

googleAnalytics?: boolean | GoogleAnalyticsConfig

Google Analytics configuration. Set to false to disable.

historyEnabled?: boolean

Enable history

historySize?: number

Max number of history items to show

inputSelector: Selector

The input element to attach the autocomplete to

minQueryLength?: number

Minimum length of the query before searching

nostoAnalytics?: boolean

Enable Nosto Analytics

render: ((container: HTMLElement, state: State) => void | PromiseLike<void>)

The function to use to render the dropdown

submit?: ((query: string, config: AutocompleteConfig<State>, options?: SearchAutocompleteOptions) => void)

The function to use to submit the search