Angular Chips

Angular Chips

·

2 min read

Angular Chips is used to enter multiple values on an input field.

Setup

Refer to PrimeNG setup documentation for download and installation steps for your environment.

Import

import {ChipsModule} from 'primeng/chips';

Getting Started

Chips requires an array as its model.

<p-chips [(ngModel)]="values"></p-chips>
export class MyModel {

    values: string[];

}

Model Driven Forms

Chips can be used in a model driven form as well.

<p-chips formControlName="cities"></p-chips>

Custom Content

A chip is customized using a ng-template element where the value is passed as the implicit variable.

<p-chips [(ngModel)]="values">
    <ng-template let-item pTemplate="item">
        {{item}} - (active) <i class="pi pi-user"></i>
    </ng-template>
</p-chips>

Theming

Chips supports various themes featuring Material, Bootstrap, Fluent as well as your own custom themes via the Designer tool.

Resources

Visit the PrimeNG Chips showcase for demos and documentation.