Skip to content

Commit 06ddcc2

Browse files
committed
docs: add example for variants of mdc list
1 parent 6011b7d commit 06ddcc2

File tree

4 files changed

+78
-0
lines changed

4 files changed

+78
-0
lines changed

src/components-examples/material/list/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import {ListSectionsExample} from './list-sections/list-sections-example';
77
import {ListSelectionExample} from './list-selection/list-selection-example';
88
import {ListSingleSelectionExample} from './list-single-selection/list-single-selection-example';
99
import {ListHarnessExample} from './list-harness/list-harness-example';
10+
import {ListVariantsExample} from './list-variants/list-variants-example';
1011

1112
export {
1213
ListHarnessExample,
1314
ListOverviewExample,
1415
ListSectionsExample,
1516
ListSelectionExample,
1617
ListSingleSelectionExample,
18+
ListVariantsExample,
1719
};
1820

1921
const EXAMPLES = [
@@ -22,6 +24,7 @@ const EXAMPLES = [
2224
ListSectionsExample,
2325
ListSelectionExample,
2426
ListSingleSelectionExample,
27+
ListVariantsExample,
2528
];
2629

2730
@NgModule({
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.example-list-wrapping {
2+
max-width: 500px;
3+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<h3>Single line lists</h3>
2+
<mat-list>
3+
<mat-list-item>
4+
<span matListItemTitle>This is the title</span>
5+
</mat-list-item>
6+
<mat-list-item>Also the title</mat-list-item>
7+
</mat-list>
8+
9+
<h3>Two line lists</h3>
10+
<mat-list>
11+
<mat-list-item>
12+
<span matListItemTitle>Title</span>
13+
<span matListItemLine>Second line</span>
14+
</mat-list-item>
15+
<mat-list-item>
16+
<span matListItemTitle>Title</span>
17+
<span>Second line</span>
18+
</mat-list-item>
19+
<mat-list-item>
20+
<span matListItemTitle>Title</span>
21+
Second line
22+
</mat-list-item>
23+
</mat-list>
24+
25+
<h3>Three line lists</h3>
26+
<mat-list>
27+
<mat-list-item>
28+
<span matListItemTitle>Title</span>
29+
<span matListItemLine>Second line</span>
30+
<span matListItemLine>Third line</span>
31+
</mat-list-item>
32+
<mat-list-item>
33+
<span matListItemTitle>Title</span>
34+
<span matListItemLine>Second line. This line will truncate.</span>
35+
<span>Third line</span>
36+
</mat-list-item>
37+
<mat-list-item>
38+
<span matListItemTitle>Title</span>
39+
<span matListItemLine>Second line. This line will truncate.</span>
40+
Third line
41+
</mat-list-item>
42+
</mat-list>
43+
44+
<h3>Three line list with secondary text wrapping</h3>
45+
<mat-list class="example-list-wrapping">
46+
<mat-list-item lines="3">
47+
<span matListItemTitle>Title</span>
48+
<span
49+
>Secondary line that will wrap because the list lines is explicitly set to 3 lines. Text
50+
inside of a `matListItemTitle` or `matListItemLine` will never wrap.
51+
</span>
52+
</mat-list-item>
53+
<mat-list-item lines="3">
54+
<span matListItemTitle>Title</span>
55+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
56+
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
57+
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
58+
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
59+
non proident, sunt in culpa qui officia deserunt mollit anim id est
60+
</mat-list-item>
61+
</mat-list>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {Component} from '@angular/core';
2+
3+
/**
4+
* @title List variants
5+
*/
6+
@Component({
7+
selector: 'list-variants-example',
8+
templateUrl: 'list-variants-example.html',
9+
styleUrls: ['./list-variants-example.css'],
10+
})
11+
export class ListVariantsExample {}

0 commit comments

Comments
 (0)