@@ -7,8 +7,8 @@ that drives a stepped workflow. Material stepper extends the CDK stepper and has
7
7
styling.
8
8
9
9
### Stepper variants
10
- There are two stepper components: ` mat-horizontal-stepper ` and ` mat-vertical-stepper ` . They
11
- can be used the same way. The only difference is the orientation of stepper.
10
+ There are two stepper components: ` mat-horizontal-stepper ` and ` mat-vertical-stepper ` . They
11
+ can be used the same way. The only difference is the orientation of stepper.
12
12
` mat-horizontal-stepper ` selector can be used to create a horizontal stepper, and
13
13
` mat-vertical-stepper ` can be used to create a vertical stepper. ` mat-step ` components need to be
14
14
placed inside either one of the two stepper components.
@@ -26,7 +26,7 @@ If a step's label is only text, then the `label` attribute can be used.
26
26
</mat-vertical-stepper >
27
27
```
28
28
29
- For more complex labels, add a template with the ` matStepLabel ` directive inside the
29
+ For more complex labels, add a template with the ` matStepLabel ` directive inside the
30
30
` mat-step ` .
31
31
``` html
32
32
<mat-vertical-stepper >
@@ -49,22 +49,22 @@ There are two button directives to support navigation between different steps:
49
49
<button mat-button matStepperNext >Next</button >
50
50
</div >
51
51
</mat-step >
52
- </mat-horizontal-stepper >
52
+ </mat-horizontal-stepper >
53
53
```
54
54
55
55
### Linear stepper
56
56
The ` linear ` attribute can be set on ` mat-horizontal-stepper ` and ` mat-vertical-stepper ` to create
57
57
a linear stepper that requires the user to complete previous steps before proceeding
58
58
to following steps. For each ` mat-step ` , the ` stepControl ` attribute can be set to the top level
59
- ` AbstractControl ` that is used to check the validity of the step.
59
+ ` AbstractControl ` that is used to check the validity of the step.
60
60
61
61
There are two possible approaches. One is using a single form for stepper, and the other is
62
62
using a different form for each step.
63
63
64
64
#### Using a single form
65
65
When using a single form for the stepper, ` matStepperPrevious ` and ` matStepperNext ` have to be
66
66
set to ` type="button" ` in order to prevent submission of the form before all steps
67
- are completed.
67
+ are completed.
68
68
69
69
``` html
70
70
<form [formGroup] =" formGroup" >
@@ -83,7 +83,7 @@ are completed.
83
83
</div >
84
84
</mat-step >
85
85
...
86
- </mat-horizontal-stepper >
86
+ </mat-horizontal-stepper >
87
87
</form >
88
88
```
89
89
@@ -106,11 +106,11 @@ are completed.
106
106
107
107
#### Optional step
108
108
If completion of a step in linear stepper is not required, then the ` optional ` attribute can be set
109
- on ` mat-step ` .
109
+ on ` mat-step ` .
110
110
111
111
#### Editable step
112
112
By default, steps are editable, which means users can return to previously completed steps and
113
- edit their responses. ` editable="true" ` can be set on ` mat-step ` to change the default.
113
+ edit their responses. ` editable="true" ` can be set on ` mat-step ` to change the default.
114
114
115
115
#### Completed step
116
116
By default, the ` completed ` attribute of a step returns ` true ` if the step is valid (in case of
@@ -124,11 +124,25 @@ this default `completed` behavior by setting the `completed` attribute as needed
124
124
- <kbd >TAB</kbd >: Focuses the next tabbable element
125
125
- <kbd >TAB</kbd >+<kbd >SHIFT</kbd >: Focuses the previous tabbable element
126
126
127
+ ### Localizing labels
128
+ Labels used by the stepper are provided through ` MatStepperIntl ` . Localization of these messages
129
+ can be done by providing a subclass with translated values in your application root module.
130
+
131
+ ``` ts
132
+ @NgModule ({
133
+ imports: [MatStepperModule ],
134
+ providers: [
135
+ {provide: MatStepperIntl , useClass: MyIntl },
136
+ ],
137
+ })
138
+ export class MyApp {}
139
+ ```
140
+
127
141
### Accessibility
128
142
The stepper is treated as a tabbed view for accessibility purposes, so it is given
129
143
` role="tablist" ` by default. The header of step that can be clicked to select the step
130
144
is given ` role="tab" ` , and the content that can be expanded upon selection is given
131
145
` role="tabpanel" ` . ` aria-selected ` attribute of step header and ` aria-expanded ` attribute of
132
146
step content is automatically set based on step selection change.
133
147
134
- The stepper and each step should be given a meaningful label via ` aria-label ` or ` aria-labelledby ` .
148
+ The stepper and each step should be given a meaningful label via ` aria-label ` or ` aria-labelledby ` .
0 commit comments