# Typeahead documentation

## TypeScript declaration

### [Typeahead](<https://github.com/siemens/element/blob/main/projects/element-ng/typeahead/si-typeahead.model.ts#L37-L37>)

**Kind:** type alias

```
import type { Typeahead } from '@siemens/element-ng/typeahead';
```

Either a [TypeaheadObservable](<index.html#t:TypeaheadObservable>) (observable of a [TypeaheadArray](<index.html#t:TypeaheadArray>)) or a [TypeaheadArray](<index.html#t:TypeaheadArray>).

```
type Typeahead = TypeaheadArray | TypeaheadObservable | TypeaheadOptionSource
```

### Types Documentation

### [TypeaheadArray](<https://github.com/siemens/element/blob/main/projects/element-ng/typeahead/si-typeahead.model.ts#L15-L15>)

**Kind:** type alias

```
import type { TypeaheadArray } from '@siemens/element-ng/typeahead';
```

An array of [TypeaheadOption](<index.html#t:TypeaheadOption>).

```
type TypeaheadArray = TypeaheadOption[]
```

### [TypeaheadObservable](<https://github.com/siemens/element/blob/main/projects/element-ng/typeahead/si-typeahead.model.ts#L19-L19>)

**Kind:** type alias

```
import type { TypeaheadObservable } from '@siemens/element-ng/typeahead';
```

An observable of a [TypeaheadArray](<index.html#t:TypeaheadArray>) (array of [TypeaheadOption](<index.html#t:TypeaheadOption>)).

```
type TypeaheadObservable = Observable<TypeaheadArray>
```

### [TypeaheadOptionSource](<https://github.com/siemens/element/blob/main/projects/element-ng/typeahead/si-typeahead.model.ts#L32-L32>)

**Kind:** type alias

```
import type { TypeaheadOptionSource } from '@siemens/element-ng/typeahead';
```

Defines a source of options for the [SiTypeaheadDirective](<../../directives/SiTypeaheadDirective/index.html#SiTypeaheadDirective>). Use it for server-side pre-filtering.

This function will be called, whenever the search value is updated by the user.

A loading indicator is shown when this function was called until the Observable completes.

```
type TypeaheadOptionSource = (search: string) => Observable<TypeaheadArray>
```

### [TypeaheadOption](<https://github.com/siemens/element/blob/main/projects/element-ng/typeahead/si-typeahead.model.ts#L11-L11>)

**Kind:** type alias

```
import type { TypeaheadOption } from '@siemens/element-ng/typeahead';
```

A singular item to be used in the typeahead. Can be either a string or an object.

```
type TypeaheadOption = string | { [key in string | number]: any }
```
