AutoComplete
proAutoComplete wraps an Input with a floating dropdown that filters a list of options as the user types.
Installation
Add this component with the NateUI CLI.
Examples
Custom Render
Controlled
Size
Disabled
Async
API
| Prop | Description | Type | Default |
|---|---|---|---|
data | Array of options to filter and display. | T[] | — |
optionKey | Function that extracts the display string from an option. Used for filtering and setting the input value on selection. | (obj: T) => string | — |
filterOptions | Whether to apply the built-in text filter before rendering data. Disable this when data is already filtered by a remote search. | boolean | true |
value | Controlled input value. | string | — |
onInputChange | Callback when the input text changes. | (value: string) => void | — |
onOptionSelected | Callback when an option is selected (click or Enter). | (option: T) => void | — |
renderOption | Custom render function for each dropdown item. | (option: T) => ReactNode | — |
size | Input size. | 'sm' | 'md' | 'lg' | 'md' |
disabled | Prevents input and blocks the dropdown. | boolean | false |
placeholder | Input placeholder text. | string | — |
prefix | Content rendered before the input text. | string | ReactNode | — |
suffix | Content rendered after the input text. | string | ReactNode | — |
invalid | Marks the input as invalid (form integration). | boolean | false |
className | Additional classes on the input element. | string | — |