Skip to content

Commit a72883f

Browse files
authored
refactor: update snippets/embedded example comments in material docs md to reflect new API (chips, menu, tabs) (#19486)
* mark regions and change docs for chips, menu and tabs * add space after colon in object literal Co-authored-by: Annie Wang <[email protected]>
1 parent 9716a01 commit a72883f

File tree

12 files changed

+55
-133
lines changed

12 files changed

+55
-133
lines changed

src/components-examples/material/menu/menu-nested/menu-nested-example.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<button mat-button [matMenuTriggerFor]="animals">Animal index</button>
2-
2+
<!-- #docregion sub-menu -->
33
<mat-menu #animals="matMenu">
44
<button mat-menu-item [matMenuTriggerFor]="vertebrates">Vertebrates</button>
55
<button mat-menu-item [matMenuTriggerFor]="invertebrates">Invertebrates</button>
@@ -12,6 +12,7 @@
1212
<button mat-menu-item>Birds</button>
1313
<button mat-menu-item>Mammals</button>
1414
</mat-menu>
15+
<!-- #enddocregion sub-menu -->
1516

1617
<mat-menu #invertebrates="matMenu">
1718
<button mat-menu-item>Insects</button>

src/components-examples/material/menu/menu-overview/menu-overview-example.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
<!-- #docregion mat-menu-trigger-for -->
12
<button mat-button [matMenuTriggerFor]="menu">Menu</button>
3+
<!-- #enddocregion mat-menu-trigger-for -->
24
<mat-menu #menu="matMenu">
35
<button mat-menu-item>Item 1</button>
46
<button mat-menu-item>Item 2</button>

src/components-examples/material/menu/menu-position/menu-position-example.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<button mat-button [matMenuTriggerFor]="aboveMenu">Above</button>
2+
<!-- #docregion menu-position -->
23
<mat-menu #aboveMenu="matMenu" yPosition="above">
4+
<!-- #enddocregion menu-position -->
35
<button mat-menu-item>Item 1</button>
46
<button mat-menu-item>Item 2</button>
57
</mat-menu>

src/components-examples/material/tabs/tab-group-align/tab-group-align-example.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
<!-- #docregion align-start -->
12
<mat-tab-group mat-align-tabs="start">
3+
<!-- #enddocregion align-start -->
24
<mat-tab label="First">Content 1</mat-tab>
35
<mat-tab label="Second">Content 2</mat-tab>
46
<mat-tab label="Third">Content 3</mat-tab>

src/components-examples/material/tabs/tab-group-animations/tab-group-animations-example.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ <h3>No animation</h3>
77
</mat-tab-group>
88

99
<h3>Very slow animation</h3>
10+
<!-- #docregion slow-animation-duration -->
1011
<mat-tab-group animationDuration="2000ms">
12+
<!-- #enddocregion slow-animation-duration -->
1113
<mat-tab label="First">Content 1</mat-tab>
1214
<mat-tab label="Second">Content 2</mat-tab>
1315
<mat-tab label="Third">Content 3</mat-tab>

src/components-examples/material/tabs/tab-group-custom-label/tab-group-custom-label-example.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<mat-tab-group>
22
<mat-tab>
3+
<!-- #docregion label-directive -->
34
<ng-template mat-tab-label>
45
<mat-icon class="example-tab-icon">thumb_up</mat-icon>
56
First
67
</ng-template>
8+
<!-- #enddocregion label-directive -->
79
Content 1
810
</mat-tab>
911

src/components-examples/material/tabs/tab-group-dynamic-height/tab-group-dynamic-height-example.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
<!-- #docregion dynamic-height -->
12
<mat-tab-group dynamicHeight>
3+
<!-- #enddocregion dynamic-height -->
24
<mat-tab label="Short tab">
35
<div class="example-small-box mat-elevation-z4">
46
Small content

src/components-examples/material/tabs/tab-group-lazy-loaded/tab-group-lazy-loaded-example.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<mat-tab-group>
2+
<!-- #docregion mat-tab-content -->
23
<mat-tab label="First">
34
<ng-template matTabContent>
45
Content 1 - Loaded: {{getTimeLoaded(1) | date:'medium'}}
56
</ng-template>
67
</mat-tab>
8+
<!-- #enddocregion mat-tab-content -->
79
<mat-tab label="Second">
810
<ng-template matTabContent>
911
Content 2 - Loaded: {{getTimeLoaded(2) | date:'medium'}}

src/components-examples/material/tabs/tab-nav-bar-basic/tab-nav-bar-basic-example.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
<!-- #docregion mat-tab-nav -->
12
<nav mat-tab-nav-bar [backgroundColor]="background">
23
<a mat-tab-link *ngFor="let link of links"
34
(click)="activeLink = link"
45
[active]="activeLink == link"> {{link}} </a>
56
<a mat-tab-link disabled>Disabled Link</a>
67
</nav>
8+
<!-- #enddocregion mat-tab-nav -->
79

810
<button mat-raised-button class="example-action-button" (click)="toggleBackground()">
911
Toggle background

src/material/chips/chips.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
`<mat-chip-list>` displays a list of values as individual, keyboard accessible, chips.
22

3-
<!-- example(chips-overview) -->
4-
5-
```html
6-
<mat-chip-list>
7-
<mat-chip>Papadum</mat-chip>
8-
<mat-chip>Naan</mat-chip>
9-
<mat-chip>Dal</mat-chip>
10-
</mat-chip-list>
11-
```
3+
<!-- example({"example": "chips-overview",
4+
"file": "chips-overview-example.html"}) -->
125

136
### Unstyled chips
147
By default, `<mat-chip>` has Material Design styles applied. For a chip with no styles applied,
@@ -59,13 +52,8 @@ also gain focus when clicked, ensuring keyboard navigation starts at the appropr
5952
If you want the chips in the list to be stacked vertically, instead of horizontally, you can apply
6053
the `mat-chip-list-stacked` class, as well as the `aria-orientation="vertical"` attribute:
6154

62-
```html
63-
<mat-chip-list class="mat-chip-list-stacked" aria-orientation="vertical">
64-
<mat-chip>Papadum</mat-chip>
65-
<mat-chip>Naan</mat-chip>
66-
<mat-chip>Dal</mat-chip>
67-
</mat-chip-list>
68-
```
55+
<!-- example({"example": "chips-stacked",
56+
"file": "chips-stacked-example.html"}) -->
6957

7058
### Specifying global configuration defaults
7159
Default options for the chips module can be specified using the `MAT_CHIPS_DEFAULT_OPTIONS`

0 commit comments

Comments
 (0)