Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 31376f7

Browse files
authored
feat(tab): Add Tab Sass mixins targeting active state colors (#4522)
1 parent cd04f82 commit 31376f7

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

demos/tab-bar.scss

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,8 @@
4848
@include mdc-tab-text-label-color($material-color-blue-600);
4949
@include mdc-tab-icon-color($material-color-blue-600);
5050
@include mdc-tab-states-color($material-color-yellow-700);
51-
}
52-
53-
.mdc-tab--active {
54-
@include mdc-tab-text-label-color($material-color-blue-900);
55-
@include mdc-tab-icon-color($material-color-blue-900);
51+
@include mdc-tab-active-text-label-color($material-color-blue-900);
52+
@include mdc-tab-active-icon-color($material-color-blue-900);
5653
}
5754

5855
.mdc-tab-indicator {

packages/mdc-tab/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ Mixin | Description
136136
`mdc-tab-icon-color($color)` | Customizes the color of the tab icon.
137137
`mdc-tab-states-color($color)`| Customizes the base states color, which affects hover/focus states and the press ripple.
138138
`mdc-tab-ink-color($color)` | Customizes the text label, icon, and base states color.
139+
`mdc-tab-active-text-label-color($color)` | Customizes the color of the active tab's text label.
140+
`mdc-tab-active-icon-color($color)` | Customizes the color of the active tab's icon.
139141
`mdc-tab-parent-positioning` | Sets the positioning of the MDCTab's parent element so that `MDCTab.computeDimensions()` reports the same values in all browsers.
140142
`mdc-tab-fixed-width($width)` | Sets the fixed width of the tab. The tab will never be smaller than the given width.
141143

packages/mdc-tab/_mixins.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@
4949
@include mdc-tab-text-label-color($color);
5050
}
5151

52+
@mixin mdc-tab-active-text-label-color($color) {
53+
&.mdc-tab--active {
54+
@include mdc-tab-text-label-color($color);
55+
}
56+
}
57+
58+
@mixin mdc-tab-active-icon-color($color) {
59+
&.mdc-tab--active {
60+
@include mdc-tab-icon-color($color);
61+
}
62+
}
63+
5264
@mixin mdc-tab-parent-positioning {
5365
position: relative;
5466
}

0 commit comments

Comments
 (0)