Skip to content

Commit d766f12

Browse files
committed
add avatar to demo input chips
1 parent cfaa17f commit d766f12

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/dev-app/chips/chips-demo.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ <h4>Multi selection</h4>
160160

161161
<mat-checkbox [(ngModel)]="disableInputs">Disabled</mat-checkbox>
162162
<mat-checkbox [(ngModel)]="editable">Editable</mat-checkbox>
163+
<mat-checkbox [(ngModel)]="peopleWithAvatar">Show Avatar</mat-checkbox>
163164
<mat-checkbox [(ngModel)]="showEditIcon">Show Edit Icon</mat-checkbox>
164165
<mat-checkbox [(ngModel)]="disabledInteractive">Disabled Interactive</mat-checkbox>
165166

@@ -178,6 +179,9 @@ <h4>Input is last child of chip grid</h4>
178179
<mat-icon>edit</mat-icon>
179180
</button>
180181
}
182+
@if (peopleWithAvatar && person.avatar) {
183+
<mat-icon matChipAvatar>{{person.avatar}}</mat-icon>
184+
}
181185
{{person.name}}
182186
<button matChipRemove aria-label="Remove contributor">
183187
<mat-icon>close</mat-icon>

src/dev-app/chips/chips-demo.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {MatIconModule} from '@angular/material/icon';
2020

2121
export interface Person {
2222
name: string;
23+
avatar?: string;
2324
}
2425

2526
export interface DemoColor {
@@ -52,6 +53,7 @@ export class ChipsDemo {
5253
listboxesWithAvatar = false;
5354
disableInputs = false;
5455
editable = false;
56+
peopleWithAvatar = false;
5557
showEditIcon = false;
5658
disabledInteractive = false;
5759
message = '';
@@ -76,12 +78,12 @@ export class ChipsDemo {
7678
selectedPeople = null;
7779

7880
people: Person[] = [
79-
{name: 'Kara'},
80-
{name: 'Jeremy'},
81-
{name: 'Topher'},
82-
{name: 'Elad'},
83-
{name: 'Kristiyan'},
84-
{name: 'Paul'},
81+
{name: 'Kara', avatar: 'K'},
82+
{name: 'Jeremy', avatar: 'J'},
83+
{name: 'Topher', avatar: 'T'},
84+
{name: 'Elad', avatar: 'E'},
85+
{name: 'Kristiyan', avatar: 'K'},
86+
{name: 'Paul', avatar: 'P'},
8587
];
8688

8789
availableColors: DemoColor[] = [

0 commit comments

Comments
 (0)