Skip to content

Function: simpleAutocomplete


simpleAutocomplete<T>(search, options): Promise<MetadataFormulaObjectResultType[]>

Utility to search over an array of autocomplete results and return only those that match the given search string.

You can do this yourself but this function helps simplify many common scenarios. Note that if you have a hardcoded list of autocomplete options, you can simply specify them directly as a list, you need not actually implement an autocomplete function.

The primary use case here is fetching a list of all possible results from an API and then refining them using the user's current search string.


autocomplete: async function(context, search) {
  const response = await context.fetcher.fetch({method: "GET", url: "/api/entities"});
  const allOptions = =>;
  return coda.simpleAutocomplete(search, allOptions);

Type parameters

Name Type
T extends AutocompleteParameterTypes


Name Type
search undefined | string
options (TypeMap[AutocompleteParameterTypeMapping[T]] | SimpleAutocompleteOption<T>)[]



Defined in