Skip to content

docs: add example for variants of mdc list #25971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components-examples/material/list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import {ListSectionsExample} from './list-sections/list-sections-example';
import {ListSelectionExample} from './list-selection/list-selection-example';
import {ListSingleSelectionExample} from './list-single-selection/list-single-selection-example';
import {ListHarnessExample} from './list-harness/list-harness-example';
import {ListVariantsExample} from './list-variants/list-variants-example';

export {
ListHarnessExample,
ListOverviewExample,
ListSectionsExample,
ListSelectionExample,
ListSingleSelectionExample,
ListVariantsExample,
};

const EXAMPLES = [
Expand All @@ -22,6 +24,7 @@ const EXAMPLES = [
ListSectionsExample,
ListSelectionExample,
ListSingleSelectionExample,
ListVariantsExample,
];

@NgModule({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.example-list-wrapping {
max-width: 500px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<h3>Single line lists</h3>
<mat-list>
<mat-list-item>
<span matListItemTitle>This is the title</span>
</mat-list-item>
<mat-list-item>Also the title</mat-list-item>
</mat-list>

<h3>Two line lists</h3>
<mat-list>
<mat-list-item>
<span matListItemTitle>Title</span>
<span matListItemLine>Second line</span>
</mat-list-item>
<mat-list-item>
<span matListItemTitle>Title</span>
<span>Second line</span>
</mat-list-item>
<mat-list-item>
<span matListItemTitle>Title</span>
Second line
</mat-list-item>
</mat-list>

<h3>Three line lists</h3>
<mat-list>
<mat-list-item>
<span matListItemTitle>Title</span>
<span matListItemLine>Second line</span>
<span matListItemLine>Third line</span>
</mat-list-item>
<mat-list-item>
<span matListItemTitle>Title</span>
<span matListItemLine>Second line. This line will truncate.</span>
<span>Third line</span>
</mat-list-item>
<mat-list-item>
<span matListItemTitle>Title</span>
<span matListItemLine>Second line. This line will truncate.</span>
Third line
</mat-list-item>
</mat-list>

<h3>Three line list with secondary text wrapping</h3>
<mat-list class="example-list-wrapping">
<mat-list-item lines="3">
<span matListItemTitle>Title</span>
<span
>Secondary line that will wrap because the list lines is explicitly set to 3 lines. Text
inside of a `matListItemTitle` or `matListItemLine` will never wrap.
</span>
</mat-list-item>
<mat-list-item lines="3">
<span matListItemTitle>Title</span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est
</mat-list-item>
</mat-list>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {Component} from '@angular/core';

/**
* @title List variants
*/
@Component({
selector: 'list-variants-example',
templateUrl: 'list-variants-example.html',
styleUrls: ['./list-variants-example.css'],
})
export class ListVariantsExample {}