Getting Started
Overview
Installation
Theme
Forms
Basic Inputs
Select
Custom Inputs
Components
Navigation
Components
69
Micro Charts
Libraries
Kanban Board
Image Designer
Video Player
Visual Builder
Content Editor
Data View
Latest npm version of @ngstarter-ui/componentsWeekly npm downloads of @ngstarter-ui/components
Purchase

Autocomplete

The Autocomplete component is a text input connected to a panel of suggested options. Use it when users need to type, filter a list, and select one matching value. It is best for searchable choices where a normal Select would feel too static or too long.

Use it for:
  • Searchable selection: Let users find an item by typing part of its label.
  • Filtered options: Connect it to reactive forms and filter options as the input value changes.
  • Object values: Store an object as the value and show readable text with displayWith.
  • Grouped suggestions: Organize options with option groups when the list has clear sections.

Build Autocomplete with an ngs-form-field, an input using ngsInput and ngsAutocomplete, an ngs-autocomplete panel, and ngs-option items. Do not use it for simple free text, small static lists, command menus, or multi-value tags.

PropTypeDefault
aria-label
The aria-label of the autocomplete
stringundefined
aria-labelledby
The aria-labelledby of the autocomplete
stringundefined
autoActiveFirstOption
Whether the first option should be highlighted when the autocomplete panel is opened.
booleanfalse
autoSelectActiveOption
Whether the active option should be selected when the autocomplete panel is closed.
booleanfalse
class
Classes to be passed to the autocomplete panel.
string | string[]undefined
disableRipple
Whether ripples are disabled.
booleanfalse
displayWith
Function used to map an option's control value to its display value in the trigger.
(value: any) => string | null() => null
hideSingleSelectionIndicator
Whether the selection indicator should be hidden for single-selection.
booleanfalse
panelWidth
Specify the width of the autocomplete panel. Can be any CSS sizing value, otherwise it will match the width of the trigger.
string | numberundefined
requireSelection
Whether the user is required to make a selection from the options.
booleanfalse
EventDescription
closedEvent that is emitted when the autocomplete panel is closed.
openedEvent that is emitted when the autocomplete panel is opened.
optionActivatedEvent that is emitted whenever an option from the list is activated (focused).
optionSelectedEvent that is emitted whenever an option from the list is selected.