Forms

Suggest

@xui/suggest

A typeahead autocomplete: the text input itself is the target. Typing filters a popover list; choosing an item fills the input. Arrow/Enter/Escape keyboard. [(value)] two-way binding.

Install

pnpm add @xui/suggest

Add the barrel to a standalone component's imports:

import { XuiSuggestImports } from '@xui/suggest';

@Component({
  imports: [XuiSuggestImports],
  // …
})

Examples

Default

Loading preview…

API

XuiSuggest

componentxui-suggest

A typeahead autocomplete: the text input itself is the target. Typing filters a popover list; choosing an item fills the input with its text. Unlike xui-select, there is no separate trigger. [(value)] two-way binding.

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the component's own rather than replacing them.''itemsreadonly T[]The options to search over.[]itemText(item: T) => stringHow an item is labelled, in both the list and the field once chosen. Also what the default filter matches against.(item: T) => (item == null ? '' : String(item))itemPredicate(query: string, item: T) => booleanCustom filter for one item against the query. Defaults to a case-insensitive substring match on itemText.itemDisabled(item: T) => booleanWhich items cannot be chosen. They stay in the list, greyed out.() => falsedisabledbooleanBlock interaction and dim the field.falseplaceholderstringText shown in the empty field.'Search…'noResultsTextstringShown in place of the list when the query matches nothing.'No results.'valuetwo-wayT | nullThe chosen item. Two-way bindable with [(value)], or via formControl/ngModel.null

Source

libs/ui/suggest/xui

xUI 2.0.0 — Apache 2.0 licensed. Built with Angular and Tailwind CSS.