Skip to content

Commit 638b0cc

Browse files
committed
stepper
1 parent 009ee77 commit 638b0cc

File tree

7 files changed

+46
-81
lines changed

7 files changed

+46
-81
lines changed

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-overview/stepper-overview-example.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
{{!isLinear ? 'Enable linear mode' : 'Disable linear mode'}}
33
</button>
44
<mat-horizontal-stepper [linear]="isLinear" #stepper>
5+
<!-- #docreion label -->
6+
<mat-step label="Welcome">
7+
Please continue.
8+
</mat-step>
9+
<!-- #enddocregion label -->
510
<mat-step [stepControl]="firstFormGroup">
611
<form [formGroup]="firstFormGroup">
712
<ng-template matStepLabel>Fill out your name</ng-template>

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

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

38+
<!-- #docregion states -->
3839
<mat-horizontal-stepper>
3940
<mat-step label="Step 1" state="phone">
4041
<p>Put down your phones.</p>
@@ -54,10 +55,13 @@
5455
</mat-step>
5556

5657
<!-- Icon overrides. -->
58+
<!-- #docregion override-icons -->
5759
<ng-template matStepperIcon="phone">
5860
<mat-icon>call_end</mat-icon>
5961
</ng-template>
6062
<ng-template matStepperIcon="chat">
6163
<mat-icon>forum</mat-icon>
6264
</ng-template>
6365
</mat-horizontal-stepper>
66+
<!-- #enddocregion override-icons -->
67+
<!-- #enddocregion states -->

src/material/expansion/expansion.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ header to align with Material Design specifications.
1717
1818
By default, the expansion-panel header includes a toggle icon at the end of the
1919
header to indicate the expansion state. This icon can be hidden via the
20-
`hideToggle` property.
20+
`hideToggle` property.
2121

2222
<!-- example({"example":"expansion-overview",
2323
"file":"expansion-overview-example.html",

src/material/stepper/stepper.md

Lines changed: 26 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
Angular Material's stepper provides a wizard-like workflow by dividing content into logical steps.
22

3-
<!-- example(stepper-overview) -->
4-
53
Material stepper builds on the foundation of the CDK stepper that is responsible for the logic
64
that drives a stepped workflow. Material stepper extends the CDK stepper and has Material Design
75
styling.
@@ -10,6 +8,8 @@ styling.
108
There are two stepper components: `mat-horizontal-stepper` and `mat-vertical-stepper`. They
119
can be used the same way. The only difference is the orientation of stepper.
1210

11+
<!-- example(stepper-overview) -->
12+
1313
<!-- example(stepper-vertical) -->
1414

1515
`mat-horizontal-stepper` selector can be used to create a horizontal stepper, and
@@ -18,49 +18,31 @@ placed inside either one of the two stepper components.
1818

1919
### Labels
2020
If a step's label is only text, then the `label` attribute can be used.
21-
```html
22-
<mat-vertical-stepper>
23-
<mat-step label="Step 1">
24-
Content 1
25-
</mat-step>
26-
<mat-step label="Step 1">
27-
Content 2
28-
</mat-step>
29-
</mat-vertical-stepper>
30-
```
21+
<!-- example({"example":"stepper-overview",
22+
"file":"stepper-overview-example.html",
23+
"region":"label"}) -->
3124

3225
For more complex labels, add a template with the `matStepLabel` directive inside the
3326
`mat-step`.
34-
```html
35-
<mat-vertical-stepper>
36-
<mat-step>
37-
<ng-template matStepLabel>...</ng-template>
38-
...
39-
</mat-step>
40-
</mat-vertical-stepper>
41-
```
27+
<!-- example({"example":"stepper-editable",
28+
"file":"stepper-editable-example.html",
29+
"region":"ng-template"}) -->
4230

4331
#### Label position
4432
For `mat-horizontal-stepper` it's possible to define the position of the label. `end` is the
4533
default value, while `bottom` will place it under the step icon instead of at its side.
4634
This behaviour is controlled by `labelPosition` property.
4735

48-
<!-- example(stepper-label-position-bottom) -->
36+
<!-- example({"example":"stepper-label-position",
37+
"file":"stepper-label-position-example.html",
38+
"region":"label-position"}) -->
4939

5040
### Stepper buttons
5141
There are two button directives to support navigation between different steps:
5242
`matStepperPrevious` and `matStepperNext`.
53-
```html
54-
<mat-horizontal-stepper>
55-
<mat-step>
56-
...
57-
<div>
58-
<button mat-button matStepperPrevious>Back</button>
59-
<button mat-button matStepperNext>Next</button>
60-
</div>
61-
</mat-step>
62-
</mat-horizontal-stepper>
63-
```
43+
<!-- example({"example":"stepper-label-position",
44+
"file":"stepper-label-position-example.html",
45+
"region":"mat-stepper"}) -->
6446

6547
### Linear stepper
6648
The `linear` attribute can be set on `mat-horizontal-stepper` and `mat-vertical-stepper` to create
@@ -122,14 +104,18 @@ are completed.
122104
If completion of a step in linear stepper is not required, then the `optional` attribute can be set
123105
on `mat-step`.
124106

125-
<!-- example(stepper-optional) -->
107+
<!-- example({"example":"stepper-optional",
108+
"file":"stepper-optional-example.html",
109+
"region":"optional"}) -->
126110

127111

128112
#### Editable step
129113
By default, steps are editable, which means users can return to previously completed steps and
130114
edit their responses. `editable="false"` can be set on `mat-step` to change the default.
131115

132-
<!-- example(stepper-editable) -->
116+
<!-- example({"example":"stepper-editable",
117+
"file":"stepper-editable-example.html",
118+
"region":"editable"}) -->
133119

134120
#### Completed step
135121
By default, the `completed` attribute of a step returns `true` if the step is valid (in case of
@@ -142,59 +128,19 @@ set via `<mat-icon>` elements. If you want to provide a different set of icons,
142128
by placing a `matStepperIcon` for each of the icons that you want to override. The `index`,
143129
`active`, and `optional` values of the individual steps are available through template variables:
144130

145-
```html
146-
<mat-vertical-stepper>
147-
<ng-template matStepperIcon="edit">
148-
<mat-icon>insert_drive_file</mat-icon>
149-
</ng-template>
150-
151-
<ng-template matStepperIcon="done">
152-
<mat-icon>done_all</mat-icon>
153-
</ng-template>
154-
155-
<!-- Custom icon with a context variable. -->
156-
<ng-template matStepperIcon="number" let-index="index">
157-
{{index + 10}}
158-
</ng-template>
159-
160-
<!-- Stepper steps go here -->
161-
</mat-vertical-stepper>
162-
```
131+
<!-- example({"example":"stepper-states",
132+
"file":"stepper-states-example.html",
133+
"region":"override-icons"}) -->
163134

164135
Note that you aren't limited to using the `mat-icon` component when providing custom icons.
165136

166137
#### Step States
167138
You can set the state of a step to whatever you want. The given state by default maps to an icon.
168139
However, it can be overridden the same way as mentioned above.
169140

170-
```html
171-
<mat-horizontal-stepper>
172-
<mat-step label="Step 1" state="phone">
173-
<p>Put down your phones.</p>
174-
<div>
175-
<button mat-button matStepperNext>Next</button>
176-
</div>
177-
</mat-step>
178-
<mat-step label="Step 2" state="chat">
179-
<p>Socialize with each other.</p>
180-
<div>
181-
<button mat-button matStepperPrevious>Back</button>
182-
<button mat-button matStepperNext>Next</button>
183-
</div>
184-
</mat-step>
185-
<mat-step label="Step 3">
186-
<p>You're welcome.</p>
187-
</mat-step>
188-
189-
<!-- Icon overrides. -->
190-
<ng-template matStepperIcon="phone">
191-
<mat-icon>call_end</mat-icon>
192-
</ng-template>
193-
<ng-template matStepperIcon="chat">
194-
<mat-icon>forum</mat-icon>
195-
</ng-template>
196-
</mat-horizontal-stepper>
197-
```
141+
<!-- example({"example":"stepper-states",
142+
"file":"stepper-states-example.html",
143+
"region":"states"}) -->
198144

199145
In order to use the custom step states, you must add the `displayDefaultIndicatorType` option to
200146
the global default stepper options which can be specified by providing a value for

0 commit comments

Comments
 (0)