Skip to content

Commit

Permalink
docs(material/tabs): Update description and examples for color input …
Browse files Browse the repository at this point in the history
…description on API page (#29336)

(cherry picked from commit f7a7289)
  • Loading branch information
amysorto committed Jun 26, 2024
1 parent 0a4712c commit fd427bf
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 64 deletions.
1 change: 0 additions & 1 deletion src/components-examples/material/tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export {TabGroupHeaderBelowExample} from './tab-group-header-below/tab-group-hea
export {TabGroupLazyLoadedExample} from './tab-group-lazy-loaded/tab-group-lazy-loaded-example';
export {TabGroupPreserveContentExample} from './tab-group-preserve-content/tab-group-preserve-content-example';
export {TabGroupStretchedExample} from './tab-group-stretched/tab-group-stretched-example';
export {TabGroupThemeExample} from './tab-group-theme/tab-group-theme-example';
export {TabNavBarBasicExample} from './tab-nav-bar-basic/tab-nav-bar-basic-example';
export {TabGroupPaginatedExample} from './tab-group-paginated/tab-group-paginated-example';
export {TabGroupInvertedExample} from './tab-group-inverted/tab-group-inverted-example';
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- #docregion mat-tab-nav -->
<nav mat-tab-nav-bar [backgroundColor]="background" [tabPanel]="tabPanel">
<nav mat-tab-nav-bar [tabPanel]="tabPanel">
@for (link of links; track link) {
<a mat-tab-link
(click)="activeLink = link"
Expand All @@ -10,9 +10,6 @@
<mat-tab-nav-panel #tabPanel></mat-tab-nav-panel>
<!-- #enddocregion mat-tab-nav -->

<button mat-raised-button class="example-action-button" (click)="toggleBackground()">
Toggle background
</button>
<button mat-raised-button class="example-action-button" (click)="addLink()">
Add link
</button>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Component} from '@angular/core';
import {ThemePalette} from '@angular/material/core';
import {MatButtonModule} from '@angular/material/button';
import {MatTabsModule} from '@angular/material/tabs';

Expand All @@ -16,11 +15,6 @@ import {MatTabsModule} from '@angular/material/tabs';
export class TabNavBarBasicExample {
links = ['First', 'Second', 'Third'];
activeLink = this.links[0];
background: ThemePalette = undefined;

toggleBackground() {
this.background = this.background ? undefined : 'primary';
}

addLink() {
this.links.push(`Link ${this.links.length + 1}`);
Expand Down
2 changes: 0 additions & 2 deletions src/dev-app/tabs/tabs-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ <h3>Tab group with lazy loaded content</h3>
<tab-group-lazy-loaded-example></tab-group-lazy-loaded-example>
<h3>Tab group stretched</h3>
<tab-group-stretched-example></tab-group-stretched-example>
<h3>Tab group theming</h3>
<tab-group-theme-example></tab-group-theme-example>
<h3>Tab navigation bar basic</h3>
<tab-nav-bar-basic-example></tab-nav-bar-basic-example>
<h3>Paginated Tabs</h3>
Expand Down
2 changes: 0 additions & 2 deletions src/dev-app/tabs/tabs-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
TabGroupPaginatedExample,
TabGroupPreserveContentExample,
TabGroupStretchedExample,
TabGroupThemeExample,
TabNavBarBasicExample,
} from '@angular/components-examples/material/tabs';
import {ChangeDetectionStrategy, Component} from '@angular/core';
Expand All @@ -37,7 +36,6 @@ import {MatTabsModule} from '@angular/material/tabs';
TabGroupInvertedExample,
TabGroupPaginatedExample,
TabNavBarBasicExample,
TabGroupThemeExample,
TabGroupStretchedExample,
TabGroupPreserveContentExample,
TabGroupLazyLoadedExample,
Expand Down
15 changes: 13 additions & 2 deletions src/material/tabs/tab-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ export class MatTabGroup implements AfterContentInit, AfterContentChecked, OnDes
/** Subscription to changes in the tab labels. */
private _tabLabelSubscription = Subscription.EMPTY;

/** Theme color of the tab group. */
/**
* Theme color of the tab group. This API is supported in M2 themes only, it
* has no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input()
color: ThemePalette;

Expand Down Expand Up @@ -204,7 +210,12 @@ export class MatTabGroup implements AfterContentInit, AfterContentChecked, OnDes
preserveContent: boolean = false;

/**
* Background color of the tab group.
* Theme color of the background of the tab group. This API is supported in M2 themes only, it
* has no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*
* @deprecated The background color should be customized through Sass theming APIs.
* @breaking-change 20.0.0 Remove this input
*/
Expand Down
8 changes: 7 additions & 1 deletion src/material/tabs/tab-nav-bar/tab-nav-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,13 @@ export class MatTabNav
/** Query list of all tab links of the tab navigation. */
@ContentChildren(forwardRef(() => MatTabLink), {descendants: true}) _items: QueryList<MatTabLink>;

/** Background color of the tab nav. */
/**
* Theme color of the background of the tab nav. This API is supported in M2 themes only, it
* has no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input()
get backgroundColor(): ThemePalette {
return this._backgroundColor;
Expand Down

0 comments on commit fd427bf

Please sign in to comment.