简体中文
Variable: autocomplete
ts
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
| Type Parameter |
|---|
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<Value | typeof CANCEL_SYMBOL>
See
https://bomb.sh/docs/clack/packages/prompts/#autocomplete
Example
ts
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,
});
