|
| 1 | + |
| 2 | +<h1>mat-list demo</h1> |
| 3 | + |
| 4 | +<button mat-raised-button (click)="thirdLine=!thirdLine">Show third line</button> |
| 5 | + |
| 6 | +<div class="demo-list"> |
| 7 | + <div> |
| 8 | + <h2>Normal lists</h2> |
| 9 | + |
| 10 | + <mat-list> |
| 11 | + <h3 mat-subheader>Items</h3> |
| 12 | + <mat-list-item *ngFor="let item of items"> |
| 13 | + {{item}} |
| 14 | + </mat-list-item> |
| 15 | + </mat-list> |
| 16 | + |
| 17 | + <mat-list> |
| 18 | + <mat-list-item *ngFor="let contact of contacts"> |
| 19 | + <h3 mat-line>{{contact.name}}</h3> |
| 20 | + <p mat-line *ngIf="thirdLine">extra line</p> |
| 21 | + <p mat-line class="demo-secondary-text">{{contact.headline}}</p> |
| 22 | + </mat-list-item> |
| 23 | + </mat-list> |
| 24 | + |
| 25 | + <mat-list> |
| 26 | + <h3 mat-subheader>Today</h3> |
| 27 | + <mat-list-item *ngFor="let message of messages; last as last"> |
| 28 | + <img mat-list-avatar [src]="message.image" alt="Image of {{message.from}}"> |
| 29 | + <h4 mat-line>{{message.from}}</h4> |
| 30 | + <p mat-line> |
| 31 | + <span>{{message.subject}} -- </span> |
| 32 | + <span class="demo-secondary-text">{{message.message}}</span> |
| 33 | + </p> |
| 34 | + <mat-divider inset *ngIf="!last"></mat-divider> |
| 35 | + </mat-list-item> |
| 36 | + <mat-divider></mat-divider> |
| 37 | + <mat-list-item *ngFor="let message of messages"> |
| 38 | + <h4 mat-line>{{message.from}}</h4> |
| 39 | + <p mat-line> {{message.subject}} </p> |
| 40 | + <p mat-line class="demo-secondary-text">{{message.message}} </p> |
| 41 | + </mat-list-item> |
| 42 | + </mat-list> |
| 43 | + </div> |
| 44 | + |
| 45 | + <div> |
| 46 | + <h2>Dense lists</h2> |
| 47 | + <mat-list dense> |
| 48 | + <h3 mat-subheader>Items</h3> |
| 49 | + <mat-list-item *ngFor="let item of items"> |
| 50 | + {{item}} |
| 51 | + </mat-list-item> |
| 52 | + </mat-list> |
| 53 | + |
| 54 | + <mat-list dense> |
| 55 | + <mat-list-item *ngFor="let contact of contacts"> |
| 56 | + <h3 mat-line>{{contact.name}}</h3> |
| 57 | + <p mat-line class="demo-secondary-text">{{contact.headline}}</p> |
| 58 | + </mat-list-item> |
| 59 | + </mat-list> |
| 60 | + |
| 61 | + <mat-list dense> |
| 62 | + <h3 mat-subheader>Today</h3> |
| 63 | + <mat-list-item *ngFor="let message of messages"> |
| 64 | + <img mat-list-avatar [src]="message.image" alt="Image of {{message.from}}"> |
| 65 | + <h4 mat-line>{{message.from}}</h4> |
| 66 | + <p mat-line> {{message.subject}} </p> |
| 67 | + <p mat-line class="demo-secondary-text">{{message.message}} </p> |
| 68 | + </mat-list-item> |
| 69 | + </mat-list> |
| 70 | + </div> |
| 71 | + <div> |
| 72 | + <h2>Nav lists</h2> |
| 73 | + <mat-nav-list> |
| 74 | + <a mat-list-item *ngFor="let link of links" href="http://www.google.com"> |
| 75 | + {{ link.name }} |
| 76 | + </a> |
| 77 | + </mat-nav-list> |
| 78 | + <div *ngIf="infoClicked"> |
| 79 | + More info! |
| 80 | + </div> |
| 81 | + <mat-nav-list> |
| 82 | + <mat-list-item *ngFor="let link of links"> |
| 83 | + <a mat-line href="http://www.google.com">{{ link.name }}</a> |
| 84 | + <button mat-icon-button (click)="infoClicked=!infoClicked"> |
| 85 | + <mat-icon>info</mat-icon> |
| 86 | + </button> |
| 87 | + </mat-list-item> |
| 88 | + </mat-nav-list> |
| 89 | + <mat-nav-list> |
| 90 | + <a mat-list-item *ngFor="let link of links; last as last" href="http://www.google.com"> |
| 91 | + <mat-icon mat-list-icon>folder</mat-icon> |
| 92 | + <span mat-line>{{ link.name }}</span> |
| 93 | + <span mat-line class="demo-secondary-text"> Description </span> |
| 94 | + <mat-divider inset *ngIf="!last"></mat-divider> |
| 95 | + </a> |
| 96 | + </mat-nav-list> |
| 97 | + <mat-nav-list dense> |
| 98 | + <mat-list-item *ngFor="let link of links"> |
| 99 | + <a mat-line href="http://www.google.com">{{ link.name }}</a> |
| 100 | + <button mat-icon-button (click)="infoClicked=!infoClicked"> |
| 101 | + <mat-icon class="material-icons">info</mat-icon> |
| 102 | + </button> |
| 103 | + </mat-list-item> |
| 104 | + </mat-nav-list> |
| 105 | + </div> |
| 106 | + |
| 107 | + <div> |
| 108 | + <h2>Action list</h2> |
| 109 | + <mat-action-list> |
| 110 | + <button mat-list-item *ngFor="let link of links" (click)="alertItem(link.name)"> |
| 111 | + {{link.name}} |
| 112 | + </button> |
| 113 | + </mat-action-list> |
| 114 | + </div> |
| 115 | + |
| 116 | + <div> |
| 117 | + <h2>Selection list</h2> |
| 118 | + |
| 119 | + TODO: Implement MDC-based selection list. |
| 120 | + </div> |
| 121 | +</div> |
0 commit comments