NG Kit

Limit tags

Caps how many chips a multi-select renders. limitTags shows only the first N chips while the field is unfocused and collapses the rest into a summary, and getLimitTagsText customises that ā€œ+Nā€ text. Focusing the field reveals every chip again.

Usage

Import AutocompleteComponent and configure it with the inputs below. The full runnable source is on the Examples tab.

html
<autocomplete
  [options]="films"
  [multiple]="true"
  [(value)]="value"
  [limitTags]="2"
  [getLimitTagsText]="getLimitTagsText"
  appearance="outline"
  label="Favorite films" />

API

This example demonstrates the inputs below. See the Autocomplete introduction for the complete API — every input, output, content template and filter helper.

Inputs

NameTypeDefaultDescription
multiplebooleanfalseAllow selecting several values, rendered as chips.
limitTagsnumber-1Max chips shown when unfocused (-1 = all).
getLimitTagsText(more: number) => string(more) => `+${more}`Label for the truncated-tags summary.
isOptionEqualToValue(a: T, b: T) => boolean===Equality used to match a value against an option.