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

Commit 35c3721

Browse files
authored
feat(tab): Implement a base states color mixin for Tab (#4421)
* Add a base states color mixin * Add an ink color mixin for base states, text label, and icon color
1 parent 183d44e commit 35c3721

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

demos/tab-bar.scss

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@
4747
@include mdc-tab-fixed-width(120px);
4848
@include mdc-tab-text-label-color($material-color-blue-600);
4949
@include mdc-tab-icon-color($material-color-blue-600);
50-
}
51-
52-
.mdc-tab__ripple {
53-
@include mdc-states($material-color-yellow-700);
50+
@include mdc-tab-states-color($material-color-yellow-700);
5451
}
5552

5653
.mdc-tab--active {

packages/mdc-tab/README.md

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

packages/mdc-tab/_mixins.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// THE SOFTWARE.
2121
//
2222

23+
@import "@material/ripple/mixins";
2324
@import "@material/theme/mixins";
2425

2526
// Public mixins
@@ -36,6 +37,18 @@
3637
}
3738
}
3839

40+
@mixin mdc-tab-states-color($color) {
41+
.mdc-tab__ripple {
42+
@include mdc-states($color);
43+
}
44+
}
45+
46+
@mixin mdc-tab-ink-color($color) {
47+
@include mdc-tab-icon-color($color);
48+
@include mdc-tab-states-color($color);
49+
@include mdc-tab-text-label-color($color);
50+
}
51+
3952
@mixin mdc-tab-parent-positioning {
4053
position: relative;
4154
}

0 commit comments

Comments
 (0)