* Options for the autocomplete prompt.
| 46 | * Options for the {@link autocomplete} prompt. |
| 47 | */ |
| 48 | interface AutocompleteSharedOptions<Value> extends CommonOptions { |
| 49 | /** |
| 50 | * The message or question shown to the user above the input. |
| 51 | */ |
| 52 | message: string; |
| 53 | |
| 54 | /** |
| 55 | * The options to present, or a function that returns the options to present |
| 56 | * allowing for custom search/filtering. |
| 57 | * |
| 58 | * @see https://bomb.sh/docs/clack/packages/prompts/#dynamic-options-getter |
| 59 | */ |
| 60 | options: Option<Value>[] | ((this: AutocompletePrompt<Option<Value>>) => Option<Value>[]); |
| 61 | |
| 62 | /** |
| 63 | * The maximum number of items/options to display in the autocomplete list at once. |
| 64 | */ |
| 65 | maxItems?: number; |
| 66 | |
| 67 | /** |
| 68 | * Placeholder text displayed when the search field is empty. When set, pressing |
| 69 | * tab copies the placeholder into the input. |
| 70 | */ |
| 71 | placeholder?: string; |
| 72 | |
| 73 | /** |
| 74 | * A function or a [Standard Schema](https://github.com/standard-schema/standard-schema) |
| 75 | * that validates user input. If a custom function is given, you should return a `string` or `Error` |
| 76 | * to show as a validation error, or `undefined` to accept the result. |
| 77 | */ |
| 78 | validate?: Validate<Value | Value[]>; |
| 79 | |
| 80 | /** |
| 81 | * Custom filter function to match options against the search input. |
| 82 | */ |
| 83 | filter?: (search: string, option: Option<Value>) => boolean; |
| 84 | } |
| 85 | |
| 86 | export interface AutocompleteOptions<Value> extends AutocompleteSharedOptions<Value> { |
| 87 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected