Autocomplete
uitemplate
Highlight color for the selected suggestion
Terminal
$termuijs render autocomplete
Installation
$ bunx termuijs add autocomplete
Copies the source into src/components/autocomplete/ and installs @termuijs/core, @termuijs/widgets.
Usage
ts
import { Autocomplete } from '@termuijs/ui'ts
new Autocomplete(style: Partial<Style> = {}, options: AutocompleteOptions = { items: [] })API Reference
Autocomplete
| Prop | Type | Required | Description |
|---|---|---|---|
items | string[] | required | List of search suggestions / candidates |
onSelect | (value: string) => void | optional | Callback when an item is selected or submitted |
onChange | (value: string) => void | optional | Callback when the query text changes |
filter | (query: string, item: string) => boolean | optional | Custom filter function to override default lowercase startsWith matching |
maxSuggestions | number | optional | Maximum number of suggestions to display in dropdown |
placeholder | string | optional | Placeholder text when query is empty |
highlightColor | Color | optional | Highlight color for the selected suggestion |