Rate this docs

Angular Bootstrap tags, labels & badges

Angular Tags, Labels & Badges - Bootstrap 4 & Material Design

Angular Bootstrap tags are components which separate content placed in the same wrapper, but in the separate pane. Only one pane can be displayed at the time.

Their main goal is to provide your visitors with an intuitive way of getting what they want. Just consider, how convenient it is to find all the articles related to web development just by using web development tag.

Contact Person Caroline Smith
Contact Person Adam Grey
Contact Person Danny Moore
Contact Person Daisy Sun
Contact Person Martha Um
Contact Person Alexa Deyn
Martha
Agnes
Caroline
Elisa
Francesca

Example heading New

Example heading New

Example heading New

Example heading New

Example heading New
Example heading New
Default
Primary
Success
Info
Warning
Danger

Labels

This is the first heading New

This is the second heading New

This is the third heading New

This is the fourth heading New

This is the fifth heading New
This is the sixth heading New

        <h1>This is the first heading <mdb-badge color="red">New</mdb-badge>
        </h1>
        <h2>This is the second heading <mdb-badge color="cyan">New</mdb-badge>
        </h2>
        <h3>This is the third heading <mdb-badge color="amber darken-2">New</mdb-badge>
        </h3>
        <h4>This is the fourth heading <mdb-badge color="pink">New</mdb-badge>
        </h4>
        <h5>This is the fifth heading <mdb-badge color="purple darken-2">New</mdb-badge>
        </h5>
        <h6>This is the sixth heading <mdb-badge color="indigo">New</mdb-badge>
        </h6>
      

Contextual colors badges

Add any of the below mentioned modifier classes to change the appearance of a tag.

Default Primary Success Info Warning Danger

        <mdb-badge default="true">Default</mdb-badge>
        <mdb-badge primary="true">Primary</mdb-badge>
        <mdb-badge success="true">Success</mdb-badge>
        <mdb-badge info="true">Info</mdb-badge>
        <mdb-badge warning="true">Warning</mdb-badge>
        <mdb-badge danger="true">Danger</mdb-badge>
      


Pills badges

Default Primary Success Info Warning Danger

        <mdb-badge pill="true" default="true">Default</mdb-badge>
        <mdb-badge pill="true" primary="true">Primary</mdb-badge>
        <mdb-badge pill="true" success="true">Success</mdb-badge>
        <mdb-badge pill="true" info="true">Info</mdb-badge>
        <mdb-badge pill="true" warning="true">Warning</mdb-badge>
        <mdb-badge pill="true" danger="true">Danger</mdb-badge>
      

Badges with icons


        <mdb-badge default="true">
          <mdb-icon icon="facebook"></mdb-icon>
        </mdb-badge>
        <mdb-badge primary="true">
          <mdb-icon icon="instagram"></mdb-icon>
        </mdb-badge>
        <mdb-badge success="true">
          <mdb-icon icon="snapchat-ghost"></mdb-icon>
        </mdb-badge>
        <mdb-badge info="true">
          <mdb-icon icon="anchor"></mdb-icon>
        </mdb-badge>
        <mdb-badge warning="true">
          <mdb-icon icon="sun-o"></mdb-icon>
        </mdb-badge>
        <mdb-badge danger="true">
          <mdb-icon icon="battery-3"></mdb-icon>
        </mdb-badge>
        <mdb-badge pill="true" color="pink">
          <mdb-icon icon="wheelchair"></mdb-icon>
        </mdb-badge>
        <mdb-badge pill="true" color="light-blue">
          <mdb-icon icon="heart-o"></mdb-icon>
        </mdb-badge>
        <mdb-badge pill="true" color="indigo">
          <mdb-icon icon="bullhorn"></mdb-icon>
        </mdb-badge>
        <mdb-badge pill="true" color="purple">
          <mdb-icon icon="comments-o"></mdb-icon>
        </mdb-badge>
        <mdb-badge pill="true" color="orange">
          <mdb-icon icon="coffee"></mdb-icon>
        </mdb-badge>
        <mdb-badge pill="true" color="green">
          <mdb-icon icon="user"></mdb-icon>
        </mdb-badge>
        <mdb-badge color="indigo">
          <mdb-icon icon="android" size="2x"></mdb-icon>
        </mdb-badge>
        <mdb-badge color="cyan">
          <mdb-icon icon="cog" size="2x"></mdb-icon>
        </mdb-badge>
        <mdb-badge color="orange">
          <mdb-icon icon="btc" size="2x"></mdb-icon>
        </mdb-badge>
        <mdb-badge pill="true" color="teal">
          <mdb-icon icon="heart" size="2x"></mdb-icon>
        </mdb-badge>
        <mdb-badge pill="true" color="green">
          <mdb-icon icon="apple" size="2x"></mdb-icon>
        </mdb-badge>
        <mdb-badge pill="true" color="purple">
          <mdb-icon icon="users" size="2x"></mdb-icon>
        </mdb-badge>
      

Chips MDB Pro component

With avatar


Contact Person Jane Doe

      <div class="chip">
        <img src="https://mdbootstrap.com/img/Photos/Avatars/avatar-6.jpg" alt="Contact Person"> Jane Doe
      </div>
    

Without avatar


Tag 1

        <div class="chip" *ngIf="hideElement">
          Tag 1
          <i class="close fa fa-times" (click)="hideElement=!hideElement"></i>
        </div>
      

        import { Component } from '@angular/core';

        @Component({
        selector: 'chips-basic-example',
        templateUrl: 'chips.component.html',
        })
        export class ChipsComponent {
          hideElement: boolean = true;
        }
      

Chips usage MDB Pro component

Adding tags


Type a name and press enter to add tag. Click X to remove it.


        <mdb-material-chips [(ngModel)]="addtags"></mdb-material-chips>
      

        import { Component } from '@angular/core';

        @Component({
        selector: 'chips-add-example',
        templateUrl: 'chips.add.component.html',
        })

        export class ChipsAddComponent {
          hideElement: boolean = true;
          addtags: string[] = [];
        }
      

Set initial tags


        <mdb-material-chips [(ngModel)]="initialtags"></mdb-material-chips>
      

        import { Component } from '@angular/core';

        @Component({
        selector: 'chips-initial-example',
        templateUrl: 'chips.initial.component.html',
        })

        export class ChipsInitialComponent {
          hideElement: boolean = true;
          addtags: string[] = [];
          initialtags: string[] = ['Tag 1', 'Tag 2', 'Tag 3'];
        }
      

Placeholer


        <mdb-material-chips [(ngModel)]="addtags" placeholder="+Tag"></mdb-material-chips>
        OR
        <mdb-material-chips [(ngModel)]="addtags" [placeholder]="placeholderVar"></mdb-material-chips>
      

        import { Component } from '@angular/core';

        @Component({
        selector: 'chips-placeholder-example',
        templateUrl: 'chips.placeholder.component.html',
        })

        export class ChipsPlaceholderComponent {
          placeholderVar: string = "Your placeholder";
        }
      

Clear tags button


      <div class="chip" *ngIf="hideElement">
        Tag 1
      </div>
      <div class="chip" *ngIf="hideElement">
        Tag 2
      </div>
      <div class="chip" *ngIf="hideElement">
        Tag 3
      </div>
      <div class="chip" *ngIf="hideElement">
        Tag 4
      </div>
      <div class="chip" *ngIf="hideElement">
        Tag 5
      </div>
      <div class="chip" *ngIf="hideElement">
        Tag 6
      </div>
      <div class="chip" *ngIf="hideElement">
        Tag 7
      </div>

      <button mdbBtn color="primary" mdbWavesEffect (click)="hideElement=!hideElement">clear tags</button>
    

Angular Tags, Labels & Badges - API

In this section you will find informations about required modules and available outputs of the tags component.


Modules used

In order to speed up your application, you can choose to import only the modules you actually need, instead of importing the entire MDB Angular library. Remember that importing the entire library, and immediately afterwards a specific module, is bad practice, and can cause application errors.

// MDB Angular Pro
import { MaterialChipsModule, BadgeModule, IconsModule, WavesModule } from 'ng-uikit-pro-standard'
// MDB Angular Free
import { BadgeModule, IconsModule, WavesModule } from 'angular-bootstrap-md'
// Angular Forms
import { FormsModule } from '@angular/forms'

Outputs

MaterialChipsComponent
Name Type Description Example
tagsfocusedChange EventEmitter<boolean> Event fired when Material Chip input got focus or when focus is out (tagsfocusedChange)="onTagsfocusedChange($event)"
labelsChange EventEmitter<string[]> Event fired when length of the chips array has changed (labelsChange)="onLabelsChange($event)"