1
1
2
2
< h1 > mat-list demo</ h1 >
3
3
4
- < button mat-raised-button (click) ="thirdLine=!thirdLine "> Show third line</ button >
4
+ < button mat-raised-button (click) ="thirdLine = !thirdLine "> Show third line</ button >
5
+ < button mat-raised-button (click) ="showBoxes = !showBoxes "> Show item boxes</ button >
6
+
7
+ < div class ="demo-list " [class.demo-show-boxes] ="showBoxes ">
5
8
6
- < div class ="demo-list ">
7
9
< div >
8
10
< h2 > Normal lists</ h2 >
9
11
@@ -16,35 +18,35 @@ <h2>Normal lists</h2>
16
18
17
19
< mat-list >
18
20
< mat-list-item *ngFor ="let contact of contacts ">
19
- < div mat-line > {{contact.name}}</ div >
20
- < div mat-line *ngIf ="thirdLine "> extra line</ div >
21
- < div mat-line > {{contact.headline}}</ div >
21
+ < div matListItemTitle > {{contact.name}}</ div >
22
+ < div matListItemLine *ngIf ="thirdLine "> extra line</ div >
23
+ < div matListItemLine > {{contact.headline}}</ div >
22
24
</ mat-list-item >
23
25
</ mat-list >
24
26
25
27
< mat-list >
26
28
< div mat-subheader > Today</ div >
27
29
< 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
- < div mat-line > {{message.from}}</ div >
30
- < div mat-line >
30
+ < img matListItemAvatar [src] ="message.image " alt ="Image of {{message.from}} ">
31
+ < div matListItemTitle > {{message.from}}</ div >
32
+ < div matListItemLine >
31
33
< span > {{message.subject}} -- </ span >
32
34
< span > {{message.message}}</ span >
33
35
</ div >
34
36
< mat-divider inset *ngIf ="!last "> </ mat-divider >
35
37
</ mat-list-item >
36
38
< mat-divider > </ mat-divider >
37
39
< mat-list-item *ngFor ="let message of messages ">
38
- < div mat-line > {{message.from}}</ div >
39
- < div mat-line > {{message.subject}}</ div >
40
- < div mat-line > {{message.message}}</ div >
40
+ < div matListItemTitle > {{message.from}}</ div >
41
+ < div matListItemLine > {{message.subject}}</ div >
42
+ < div matListItemLine > {{message.message}}</ div >
41
43
</ mat-list-item >
42
44
</ mat-list >
43
45
44
46
< mat-list >
45
47
< mat-list-item *ngFor ="let link of links ">
46
- < span mat-line > {{ link.name }}</ span >
47
- < button mat-icon-button (click) ="infoClicked=!infoClicked ">
48
+ < span matListItemTitle > {{ link.name }}</ span >
49
+ < button matListItemMeta mat-icon-button (click) ="infoClicked=!infoClicked ">
48
50
< mat-icon > info</ mat-icon >
49
51
</ button >
50
52
</ mat-list-item >
@@ -62,25 +64,25 @@ <h2>Dense lists</h2>
62
64
63
65
< mat-list dense >
64
66
< mat-list-item *ngFor ="let contact of contacts ">
65
- < div mat-line > {{contact.name}}</ div >
66
- < div mat-line > {{contact.headline}}</ div >
67
+ < div matListItemTitle > {{contact.name}}</ div >
68
+ < div matListItemLine > {{contact.headline}}</ div >
67
69
</ mat-list-item >
68
70
</ mat-list >
69
71
70
72
< mat-list dense >
71
73
< div mat-subheader > Today</ div >
72
74
< mat-list-item *ngFor ="let message of messages ">
73
- < img mat-list-avatar [src] ="message.image " alt ="Image of {{message.from}} ">
74
- < div mat-line > {{message.from}}</ div >
75
- < div mat-line > {{message.subject}}</ div >
76
- < div mat-line > {{message.message}}</ div >
75
+ < img matListItemAvatar [src] ="message.image " alt ="Image of {{message.from}} ">
76
+ < div matListItemTitle > {{message.from}}</ div >
77
+ < div matListItemLine > {{message.subject}}</ div >
78
+ < div matListItemLine > {{message.message}}</ div >
77
79
</ mat-list-item >
78
80
</ mat-list >
79
81
80
82
< mat-list dense >
81
83
< mat-list-item *ngFor ="let link of links ">
82
- < span mat-line > {{ link.name }}</ span >
83
- < button mat-icon-button (click) ="infoClicked=!infoClicked ">
84
+ < span matListItemTitle > {{ link.name }}</ span >
85
+ < button matListItemMeta mat-icon-button (click) ="infoClicked=!infoClicked ">
84
86
< mat-icon class ="material-icons "> info</ mat-icon >
85
87
</ button >
86
88
</ mat-list-item >
@@ -98,8 +100,8 @@ <h2>Nav lists</h2>
98
100
</ div >
99
101
< mat-nav-list >
100
102
< a mat-list-item *ngFor ="let link of links; last as last " href ="http://www.google.com ">
101
- < mat-icon mat-list-icon > folder</ mat-icon >
102
- < span mat-line > {{ link.name }}</ span >
103
+ < mat-icon matListItemIcon > folder</ mat-icon >
104
+ < span matListItemTitle > {{ link.name }}</ span >
103
105
</ a >
104
106
</ mat-nav-list >
105
107
</ div >
@@ -134,13 +136,13 @@ <h2>Selection list</h2>
134
136
< div mat-subheader > Dogs</ div >
135
137
136
138
< mat-list-option checkboxPosition ="before ">
137
- < img matListAvatar src ="https://material.angular.io/assets/img/examples/shiba1.jpg ">
138
- < span matLine > Shiba Inu</ span >
139
+ < img matListItemAvatar src ="https://material.angular.io/assets/img/examples/shiba1.jpg ">
140
+ < span matListItemTitle > Shiba Inu</ span >
139
141
</ mat-list-option >
140
142
141
143
< mat-list-option checkboxPosition ="after ">
142
- < img matListAvatar src ="https://material.angular.io/assets/img/examples/shiba2.jpg ">
143
- < span matLine > Other Shiba Inu</ span >
144
+ < img matListItemAvatar src ="https://material.angular.io/assets/img/examples/shiba2.jpg ">
145
+ < span matListItemTitle > Other Shiba Inu</ span >
144
146
</ mat-list-option >
145
147
</ mat-selection-list >
146
148
@@ -183,21 +185,52 @@ <h2>Single Selection list</h2>
183
185
< p > Selected: {{favoriteOptions | json}}</ p >
184
186
</ div >
185
187
188
+ < div >
189
+ < h2 > Line scenarios</ h2 >
190
+
191
+ < mat-list >
192
+ < mat-list-item > Title</ mat-list-item >
193
+ < mat-list-item lines ="2 ">
194
+ < span matListItemTitle > Title</ span >
195
+ < span > This is unscoped text content that is supposed to not wrap. The list has only
196
+ acquired two lines and therefore there is no space for wrapping.</ span >
197
+ </ mat-list-item >
198
+ < mat-list-item lines ="3 ">
199
+ < span matListItemTitle > Title</ span >
200
+ < span > This is unscoped text content that is supposed to wrap to the third line.
201
+ The list item acquire spaces for three lines and text should have an ellipsis in the
202
+ third line upon text overflow.</ span >
203
+ </ mat-list-item >
204
+ < mat-list-item >
205
+ < span matListItemTitle > Title</ span >
206
+ < span > This is unscoped text content that is supposed to not wrap. The list has only
207
+ acquired two lines (automatically) and therefore there is no space for wrapping.</ span >
208
+ </ mat-list-item >
209
+ < mat-list-item >
210
+ < span matListItemTitle > Title</ span >
211
+ < span matListItemLine > Secondary line</ span >
212
+ < span matListItemLine > Tertiary line</ span >
213
+ </ mat-list-item >
214
+ </ mat-list >
215
+
216
+ < button mat-raised-button (click) ="showBoxes = !showBoxes "> Show item boxes</ button >
217
+ </ div >
218
+
186
219
< div >
187
220
< h2 > Line alignment</ h2 >
188
221
189
222
< mat-list >
190
223
< mat-list-item *ngFor ="let link of links ">
191
- < span mat-line > {{ link.name }}</ span >
192
- < span > Not in an < i > matLine </ i > </ span >
224
+ < span matListItemTitle > {{ link.name }}</ span >
225
+ < span > Unscoped content </ span >
193
226
</ mat-list-item >
194
227
</ mat-list >
195
228
196
229
< mat-selection-list >
197
230
< mat-list-option value ="first "> First</ mat-list-option >
198
231
< mat-list-option value ="second ">
199
- < span matLine > Second</ span >
200
- < span > Not in an < i > matLine </ i > </ span >
232
+ < span matListItemTitle > Second</ span >
233
+ < span > Unscoped content </ span >
201
234
</ mat-list-option >
202
235
</ mat-selection-list >
203
236
</ div >
@@ -207,19 +240,19 @@ <h2>Icon alignment in selection list</h2>
207
240
208
241
< mat-selection-list >
209
242
< mat-list-option value ="bananas " [checkboxPosition] ="checkboxPosition ">
210
- < mat-icon matListIcon > info</ mat-icon >
243
+ < mat-icon matListItemIcon > info</ mat-icon >
211
244
Bananas
212
245
</ mat-list-option >
213
246
< mat-list-option value ="oranges " [checkboxPosition] ="checkboxPosition ">
214
- < mat-icon matListIcon #ok > info</ mat-icon >
247
+ < mat-icon matListItemIcon #ok > info</ mat-icon >
215
248
Oranges
216
249
</ mat-list-option >
217
250
< mat-list-option value ="cake " [checkboxPosition] ="checkboxPosition ">
218
- < mat-icon matListIcon > info</ mat-icon >
251
+ < mat-icon matListItemIcon > info</ mat-icon >
219
252
Cake
220
253
</ mat-list-option >
221
254
< mat-list-option value ="fries " [checkboxPosition] ="checkboxPosition ">
222
- < mat-icon matListIcon > info</ mat-icon >
255
+ < mat-icon matListItemIcon > info</ mat-icon >
223
256
Fries
224
257
</ mat-list-option >
225
258
</ mat-selection-list >
0 commit comments