File tree Expand file tree Collapse file tree 5 files changed +46
-1
lines changed
material-examples/tab-group-align Expand file tree Collapse file tree 5 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 82
82
83
83
.mat-tab-labels {
84
84
display : flex ;
85
+
86
+ [mat-align-tabs = ' center' ] & {
87
+ justify-content : center ;
88
+ }
89
+
90
+ [mat-align-tabs = ' end' ] & {
91
+ justify-content : flex-end ;
92
+ }
85
93
}
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ the `active` property to determine which tab is currently active. The correspond
83
83
### Lazy Loading
84
84
By default, the tab contents are eagerly loaded. Eagerly loaded tabs
85
85
will initalize the child components but not inject them into the DOM
86
- until the tab is activated.
86
+ until the tab is activated.
87
87
88
88
89
89
If the tab contains several complex child components or the tab's contents
@@ -108,6 +108,12 @@ with the `matTabContent` attribute.
108
108
</mat-tab-group >
109
109
```
110
110
111
+ ### Label alignment
112
+ If you want to align the tab labels in the center or towards the end of the container, you can
113
+ do so using the ` [mat-align-tabs] ` attribute.
114
+
115
+ <!-- example(tab-group-align) -->
116
+
111
117
### Accessibility
112
118
Tabs without text or labels should be given a meaningful label via ` aria-label ` or
113
119
` aria-labelledby ` . For ` MatTabNav ` , the ` <nav> ` element should have a label as well.
Original file line number Diff line number Diff line change
1
+ .mat-tab-group {
2
+ margin-bottom : 48px ;
3
+ }
Original file line number Diff line number Diff line change
1
+ < mat-tab-group mat-align-tabs ="start ">
2
+ < mat-tab label ="First "> Content 1</ mat-tab >
3
+ < mat-tab label ="Second "> Content 2</ mat-tab >
4
+ < mat-tab label ="Third "> Content 3</ mat-tab >
5
+ </ mat-tab-group >
6
+
7
+ < mat-tab-group mat-align-tabs ="center ">
8
+ < mat-tab label ="First "> Content 1</ mat-tab >
9
+ < mat-tab label ="Second "> Content 2</ mat-tab >
10
+ < mat-tab label ="Third "> Content 3</ mat-tab >
11
+ </ mat-tab-group >
12
+
13
+ < mat-tab-group mat-align-tabs ="end ">
14
+ < mat-tab label ="First "> Content 1</ mat-tab >
15
+ < mat-tab label ="Second "> Content 2</ mat-tab >
16
+ < mat-tab label ="Third "> Content 3</ mat-tab >
17
+ </ mat-tab-group >
Original file line number Diff line number Diff line change
1
+ import { Component } from '@angular/core' ;
2
+
3
+ /**
4
+ * @title Tab group with aligned labels
5
+ */
6
+ @Component ( {
7
+ selector : 'tab-group-align-example' ,
8
+ templateUrl : 'tab-group-align-example.html' ,
9
+ styleUrls : [ 'tab-group-align-example.css' ] ,
10
+ } )
11
+ export class TabGroupAlignExample { }
You can’t perform that action at this time.
0 commit comments