Skip to content

Commit ef3cfcd

Browse files
annieywmmalerba
authored andcommitted
refactor: update snippets/embedded example comments in material docs md to reflect new API (panel, stepper) (#19680)
* expansion panel * stepper * add space in obj literal
1 parent 5f15763 commit ef3cfcd

File tree

9 files changed

+72
-160
lines changed

9 files changed

+72
-160
lines changed

src/components-examples/material/expansion/expansion-expand-collapse-all/expansion-expand-collapse-all-example.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<button mat-button (click)="accordion.openAll()">Expand All</button>
33
<button mat-button (click)="accordion.closeAll()">Collapse All</button>
44
</div>
5+
<!-- #docregion multi -->
56
<mat-accordion class="example-headers-align" multi>
7+
<!-- #enddocregion multi -->
68
<mat-expansion-panel>
79
<mat-expansion-panel-header>
810
<mat-panel-title>
@@ -25,8 +27,9 @@
2527
</mat-form-field>
2628

2729
</mat-expansion-panel>
28-
30+
<!-- #docregion disabled -->
2931
<mat-expansion-panel disabled>
32+
<!-- #enddocregion disabled -->
3033
<mat-expansion-panel-header>
3134
<mat-panel-title>
3235
Destination

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

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
<mat-accordion>
2-
<mat-expansion-panel>
2+
<!-- #docregion basic-panel -->
3+
<!-- #docregion hide-toggle -->
4+
<mat-expansion-panel hideToggle>
5+
<!-- #enddocregion hide-toggle -->
36
<mat-expansion-panel-header>
47
<mat-panel-title>
5-
Personal data
8+
This is the expansion title
69
</mat-panel-title>
710
<mat-panel-description>
8-
Type your name and age
11+
This is a summary of the content
912
</mat-panel-description>
1013
</mat-expansion-panel-header>
11-
12-
<mat-form-field>
13-
<mat-label>First name</mat-label>
14-
<input matInput>
15-
</mat-form-field>
16-
17-
<mat-form-field>
18-
<mat-label>Age</mat-label>
19-
<input matInput type="number" min="1">
20-
</mat-form-field>
14+
<p>This is the primary content of the panel.</p>
2115
</mat-expansion-panel>
16+
<!-- #enddocregion basic-panel -->
2217
<mat-expansion-panel (opened)="panelOpenState = true"
2318
(closed)="panelOpenState = false">
2419
<mat-expansion-panel-header>

src/components-examples/material/expansion/expansion-steps/expansion-steps-example.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
<mat-label>Age</mat-label>
2020
<input matInput type="number" min="1">
2121
</mat-form-field>
22-
22+
<!-- #docregion action-bar -->
2323
<mat-action-row>
2424
<button mat-button color="primary" (click)="nextStep()">Next</button>
2525
</mat-action-row>
26+
<!-- #enddocregion action-bar -->
2627
</mat-expansion-panel>
2728

2829
<mat-expansion-panel [expanded]="step === 1" (opened)="setStep(1)" hideToggle>

src/components-examples/material/stepper/stepper-editable/stepper-editable-example.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
</button>
44

55
<mat-horizontal-stepper linear #stepper>
6+
<!-- #docregion editable -->
67
<mat-step [stepControl]="firstFormGroup" [editable]="isEditable">
8+
<!-- #enddocregion editable -->
79
<form [formGroup]="firstFormGroup">
10+
<!-- #edocregion ng-template -->
811
<ng-template matStepLabel>Fill out your name</ng-template>
12+
<!-- #enddocregion ng-template -->
913
<mat-form-field>
1014
<mat-label>Name</mat-label>
1115
<input matInput formControlName="firstCtrl" placeholder="Last name, First name" required>

src/components-examples/material/stepper/stepper-label-position-bottom/stepper-label-position-bottom-example.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
<!-- #docregion label-position -->
12
<mat-horizontal-stepper labelPosition="bottom" #stepper>
3+
<!-- #enddocregion label-position -->
24
<mat-step [stepControl]="firstFormGroup">
35
<form [formGroup]="firstFormGroup">
46
<ng-template matStepLabel>Fill out your name</ng-template>
@@ -20,8 +22,10 @@
2022
required>
2123
</mat-form-field>
2224
<div>
25+
<!-- #docregion mat-stepper -->
2326
<button mat-button matStepperPrevious>Back</button>
2427
<button mat-button matStepperNext>Next</button>
28+
<!-- #enddocregion mat-stepper -->
2529
</div>
2630
</form>
2731
</mat-step>

src/components-examples/material/stepper/stepper-optional/stepper-optional-example.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
</div>
1616
</form>
1717
</mat-step>
18+
<!-- #docregion optional -->
1819
<mat-step [stepControl]="secondFormGroup" [optional]="isOptional">
20+
<!-- #enddocregion optional -->
1921
<form [formGroup]="secondFormGroup">
2022
<ng-template matStepLabel>Fill out your address</ng-template>
2123
<mat-form-field>

src/components-examples/material/stepper/stepper-states/stepper-states-example.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@
3535
</mat-step>
3636
</mat-horizontal-stepper>
3737

38+
<!-- #docregion states -->
3839
<mat-horizontal-stepper>
40+
<!-- #docregion label -->
3941
<mat-step label="Step 1" state="phone">
4042
<p>Put down your phones.</p>
4143
<div>
4244
<button mat-button matStepperNext>Next</button>
4345
</div>
4446
</mat-step>
47+
<!-- #enddocregion label -->
4548
<mat-step label="Step 2" state="chat">
4649
<p>Socialize with each other.</p>
4750
<div>
@@ -54,10 +57,13 @@
5457
</mat-step>
5558

5659
<!-- Icon overrides. -->
60+
<!-- #docregion override-icons -->
5761
<ng-template matStepperIcon="phone">
5862
<mat-icon>call_end</mat-icon>
5963
</ng-template>
6064
<ng-template matStepperIcon="chat">
6165
<mat-icon>forum</mat-icon>
6266
</ng-template>
6367
</mat-horizontal-stepper>
68+
<!-- #enddocregion override-icons -->
69+
<!-- #enddocregion states -->

src/material/expansion/expansion.md

Lines changed: 16 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4,100 +4,51 @@
44

55
### Expansion-panel content
66

7-
Each expansion-panel must include a header and may optionally include an action bar.
8-
97
#### Header
108

119
The `<mat-expansion-panel-header>` shows a summary of the panel content and acts
1210
as the control for expanding and collapsing. This header may optionally contain an
1311
`<mat-panel-title>` and an `<mat-panel-description>`, which format the content of the
1412
header to align with Material Design specifications.
1513

14+
<!-- example({"example": "expansion-overview",
15+
"file": "expansion-overview-example.html",
16+
"region": "basic-panel"}) -->
17+
1618
By default, the expansion-panel header includes a toggle icon at the end of the
1719
header to indicate the expansion state. This icon can be hidden via the
1820
`hideToggle` property.
1921

20-
```html
21-
<mat-expansion-panel>
22-
<mat-expansion-panel-header>
23-
<mat-panel-title>
24-
This is the expansion title
25-
</mat-panel-title>
26-
<mat-panel-description>
27-
This is a summary of the content
28-
</mat-panel-description>
29-
</mat-expansion-panel-header>
30-
31-
<p>This is the primary content of the panel.</p>
32-
33-
</mat-expansion-panel>
34-
```
22+
<!-- example({"example": "expansion-overview",
23+
"file": "expansion-overview-example.html",
24+
"region": "hide-toggle"}) -->
3525

3626
#### Action bar
3727

3828
Actions may optionally be included at the bottom of the panel, visible only when the expansion
3929
is in its expanded state.
4030

41-
```html
42-
<mat-expansion-panel>
43-
<mat-expansion-panel-header>
44-
This is the expansion title
45-
</mat-expansion-panel-header>
46-
47-
<p>This is the primary content of the panel.</p>
48-
49-
<mat-action-row>
50-
<button mat-button>Click me</button>
51-
</mat-action-row>
52-
</mat-expansion-panel>
53-
```
54-
31+
<!-- example({"example": "expansion-steps",
32+
"file": "expansion-steps-example.html",
33+
"region": "action-bar"}) -->
5534
#### Disabling a panel
5635

5736
Expansion panels can be disabled using the `disabled` attribute. A disabled expansion panel can't
5837
be toggled by the user, but can still be manipulated programmatically.
5938

60-
```html
61-
<mat-expansion-panel [disabled]="isDisabled">
62-
<mat-expansion-panel-header>
63-
This is the expansion title
64-
</mat-expansion-panel-header>
65-
<mat-panel-description>
66-
This is a summary of the content
67-
</mat-panel-description>
68-
</mat-expansion-panel>
69-
```
70-
39+
<!-- example({"example": "expansion-expand-collapse-all",
40+
"file": "expansion-expand-collapse-all-example.html",
41+
"region": "disabled"}) -->
7142

7243
### Accordion
7344

7445
Multiple expansion-panels can be combined into an accordion. The `multi="true"` input allows the
7546
expansions state to be set independently of each other. When `multi="false"` (default) just one
7647
panel can be expanded at a given time:
7748

78-
```html
79-
<mat-accordion>
80-
81-
<mat-expansion-panel>
82-
<mat-expansion-panel-header>
83-
This is the expansion 1 title
84-
</mat-expansion-panel-header>
85-
86-
This the expansion 1 content
87-
88-
</mat-expansion-panel>
89-
90-
<mat-expansion-panel>
91-
<mat-expansion-panel-header>
92-
This is the expansion 2 title
93-
</mat-expansion-panel-header>
94-
95-
This the expansion 2 content
96-
97-
</mat-expansion-panel>
98-
99-
</mat-accordion>
100-
```
49+
<!-- example({"example": "expansion-expand-collapse-all",
50+
"file": "expansion-expand-collapse-all-example.html",
51+
"region": "multi"}) -->
10152

10253
### Lazy rendering
10354
By default, the expansion panel content will be initialized even when the panel is closed.

0 commit comments

Comments
 (0)