# autocomplete

> Turns a server-rendered `Autocomplete` into an ARIA combobox: the native `<datalist>` gives way to a styled listbox that filters as the reader types, walks with the arrows and picks on Enter or a press.

```ts
import { autocomplete } from "@sdxc/ui/mixins";
```

Enhances the `[data-slot="autocomplete"]` around the host into a combobox over its styled
list, and undoes nothing on removal beyond dropping its listeners. Mount it on a hidden
element inside the autocomplete, which is how the island that carries it renders.

## Signature

```ts
autocomplete(): MixinDescriptor<HTMLElement>
```

## Examples

```tsx
<span hidden mix={autocomplete()} />
```

## Used with it

The events, constants and types its module publishes, each imported from `@sdxc/ui/mixins` too.

### AUTOCOMPLETE_SELECT_EVENT

Name of the bubbling event a pick dispatches on the field, carrying AutocompleteSelectDetail.

#### Signature

```ts
const AUTOCOMPLETE_SELECT_EVENT = "autocomplete-select"
```

### AutocompleteSelectDetail

The option a pick chose, as the `detail` of AUTOCOMPLETE_SELECT_EVENT.

#### Members

| Member | Type | Description |
| --- | --- | --- |
| `value` | `string` |  |
| `label` | `string` |  |
