---
url: /reference/api/logger/prompts.Variable.autocomplete.md
---
# Variable: autocomplete

```ts twoslash
// @include: imports
const autocomplete: <Value>(opts) => Promise<Value | typeof CANCEL_SYMBOL>;
```

Defined in: node\_modules/.pnpm/@clack+prompts@1.9.0/node\_modules/@clack/prompts/dist/index.d.mts:185

The `autocomplete` prompt combines a text input with a searchable list of options.
It's perfect for when you have a large list of options and want to help users
find what they're looking for quickly.

## Type Parameters

&#x20;`Value`

## Parameters

`opts`

[`AutocompleteOptions`](prompts.Interface.AutocompleteOptions.md)<`Value`>

## Returns

`Promise`<`Value` | *typeof* [`CANCEL_SYMBOL`](prompts.Variable.CANCEL_SYMBOL.md)>

## See

https://bomb.sh/docs/clack/packages/prompts/#autocomplete

## Example

```ts twoslash
// @include: imports
import { autocomplete } from "@clack/prompts";

const framework = await autocomplete({
  message: "Search for a framework",
  options: [
    { value: "next", label: "Next.js", hint: "React framework" },
    { value: "astro", label: "Astro", hint: "Content-focused" },
    { value: "svelte", label: "SvelteKit", hint: "Compile-time framework" },
    { value: "remix", label: "Remix", hint: "Full stack framework" },
    { value: "nuxt", label: "Nuxt", hint: "Vue framework" },
  ],
  placeholder: "Type to search...",
  maxItems: 5,
});
```
