-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prototype(tabs): create prototype tabs based on MDC web (#16805)
Adds an implementation of the Angular Material tabs that is based on MDC web. The API is exactly the same, except for a couple of differences: 1. The ink bar has been switched to use MDC's `tab-indicator`. As such the styling and the animation are slightly different. 2. Previously `MatTabLink` used to be a `Directive`, however now it's a `Component`, because we need some extra markup around the content.
- Loading branch information
Showing
48 changed files
with
4,043 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,113 @@ | ||
<!-- TODO: copy in demo template from existing tabs demo. --> | ||
Not yet implemented. | ||
<div class="mat-typography"> | ||
<h2>Paginated tabs</h2> | ||
<mat-tab-group> | ||
<mat-tab [label]="tab" *ngFor="let tab of lotsOfTabs">Content</mat-tab> | ||
</mat-tab-group> | ||
|
||
<h2>Themed tabs</h2> | ||
<mat-tab-group [color]="'primary'"> | ||
<mat-tab label="First">Content 1</mat-tab> | ||
<mat-tab label="Second">Content 2</mat-tab> | ||
<mat-tab label="Third">Content 3</mat-tab> | ||
<mat-tab label="Fourth" disabled>Content 4</mat-tab> | ||
</mat-tab-group> | ||
|
||
<mat-tab-group [color]="'accent'"> | ||
<mat-tab label="First">Content 1</mat-tab> | ||
<mat-tab label="Second">Content 2</mat-tab> | ||
<mat-tab label="Third">Content 3</mat-tab> | ||
<mat-tab label="Fourth" disabled>Content 4</mat-tab> | ||
</mat-tab-group> | ||
|
||
<mat-tab-group [color]="'warn'"> | ||
<mat-tab label="First">Content 1</mat-tab> | ||
<mat-tab label="Second">Content 2</mat-tab> | ||
<mat-tab label="Third">Content 3</mat-tab> | ||
<mat-tab label="Fourth" disabled>Content 4</mat-tab> | ||
</mat-tab-group> | ||
|
||
<h2>Stretched tabs</h2> | ||
<mat-tab-group mat-stretch-tabs> | ||
<mat-tab label="First">Content 1</mat-tab> | ||
<mat-tab label="Second">Content 2</mat-tab> | ||
<mat-tab label="Third">Content 3</mat-tab> | ||
</mat-tab-group> | ||
|
||
<h2>Aligned tabs</h2> | ||
<mat-tab-group mat-align-tabs="start"> | ||
<mat-tab label="First">Content 1</mat-tab> | ||
<mat-tab label="Second">Content 2</mat-tab> | ||
<mat-tab label="Third">Content 3</mat-tab> | ||
</mat-tab-group> | ||
|
||
<mat-tab-group mat-align-tabs="center"> | ||
<mat-tab label="First">Content 1</mat-tab> | ||
<mat-tab label="Second">Content 2</mat-tab> | ||
<mat-tab label="Third">Content 3</mat-tab> | ||
</mat-tab-group> | ||
|
||
<mat-tab-group mat-align-tabs="end"> | ||
<mat-tab label="First">Content 1</mat-tab> | ||
<mat-tab label="Second">Content 2</mat-tab> | ||
<mat-tab label="Third">Content 3</mat-tab> | ||
</mat-tab-group> | ||
|
||
<h2>Inverted tabs</h2> | ||
<mat-tab-group headerPosition="below"> | ||
<mat-tab label="First">Content 1</mat-tab> | ||
<mat-tab label="Second">Content 2</mat-tab> | ||
<mat-tab label="Third">Content 3</mat-tab> | ||
</mat-tab-group> | ||
|
||
<h2>Tabs with background color</h2> | ||
<div> | ||
<mat-button-toggle-group #backgroundColorToggle="matButtonToggleGroup" | ||
value="primary" | ||
aria-label="Change color"> | ||
<mat-button-toggle value="primary">Primary</mat-button-toggle> | ||
<mat-button-toggle value="accent">Accent</mat-button-toggle> | ||
<mat-button-toggle value="warn">Warn</mat-button-toggle> | ||
</mat-button-toggle-group> | ||
</div> | ||
|
||
<mat-tab-group [backgroundColor]="backgroundColorToggle.value"> | ||
<mat-tab [label]="tab" *ngFor="let tab of lotsOfTabs">Content</mat-tab> | ||
</mat-tab-group> | ||
|
||
<h2>Template labels</h2> | ||
|
||
<mat-tab-group> | ||
<mat-tab> | ||
<ng-template mat-tab-label>One</ng-template> | ||
First tab's content | ||
</mat-tab> | ||
<mat-tab> | ||
<ng-template mat-tab-label>Two</ng-template> | ||
Second tab's content | ||
</mat-tab> | ||
<mat-tab> | ||
<ng-template mat-tab-label>Three</ng-template> | ||
Third tab's content | ||
</mat-tab> | ||
</mat-tab-group> | ||
|
||
<h2>Lazy tabs</h2> | ||
<mat-tab-group> | ||
<mat-tab label="One"> | ||
Eager | ||
</mat-tab> | ||
<mat-tab label="Two"> | ||
<ng-template matTabContent> | ||
<div class="child">Lazy</div> | ||
</ng-template> | ||
</mat-tab> | ||
</mat-tab-group> | ||
|
||
<h2>Tab nav bar</h2> | ||
<nav mat-tab-nav-bar> | ||
<a mat-tab-link *ngFor="let link of links" | ||
(click)="activeLink = link" | ||
[active]="activeLink == link">{{link}}</a> | ||
<a mat-tab-link disabled>Disabled Link</a> | ||
</nav> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
// TODO: copy in demo styles from existing tabs demo. | ||
mat-tab-group { | ||
margin-bottom: 32px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,18 @@ | ||
<!-- TODO: copy implementation from existing tabs e2e page. --> | ||
<section> | ||
<mat-tab-group> | ||
<mat-tab> | ||
<ng-template mat-tab-label>One</ng-template> | ||
<mat-form-field> | ||
<textarea matInput placeholder="Autosize textarea" cdkTextareaAutosize>This is an autosize textarea, it should adjust to the size of its content.</textarea> | ||
</mat-form-field> | ||
</mat-tab> | ||
<mat-tab> | ||
<ng-template mat-tab-label>Two</ng-template> | ||
Second tab's content | ||
</mat-tab> | ||
<mat-tab> | ||
<ng-template mat-tab-label>Three</ng-template> | ||
Third tab's content | ||
</mat-tab> | ||
</mat-tab-group> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.