Skip to content

Commit dc50f5b

Browse files
authored
feat: Support tab font customization and fix hover style on disabled tabs (#907)
* Add support for customizing the tab font size and weight * Do not apply hover style to disabled tabs
1 parent becbf79 commit dc50f5b

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/tabs/tabs.module.css

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
--reactist-tab-border-width: 1px;
3131
--reactist-tab-padding-x: var(--reactist-spacing-medium);
3232
--reactist-tab-padding-y: var(--reactist-spacing-small);
33+
--reactist-tab-font-size: var(--reactist-font-size-body);
34+
--reactist-tab-font-weight: var(--reactist-font-weight-medium);
3335
--reactist-tab-line-height: 21px;
3436
}
3537

@@ -39,8 +41,8 @@
3941
border: none;
4042
background: none;
4143
cursor: pointer;
42-
font-size: var(--reactist-font-size-body);
43-
font-weight: var(--reactist-font-weight-medium);
44+
font-size: var(--reactist-tab-font-size);
45+
font-weight: var(--reactist-tab-font-weight);
4446
line-height: var(--reactist-tab-line-height);
4547
z-index: 1;
4648
text-decoration: none;
@@ -88,19 +90,19 @@
8890
color: var(--reactist-tab-neutral-selected-tint);
8991
}
9092

91-
.tab[aria-selected='false']:hover,
92-
.tab-neutral[aria-selected='false']:hover {
93-
background-color: var(--reactist-tab-neutral-hover-fill);
94-
color: var(--reactist-tab-neutral-hover-tint);
95-
}
96-
9793
.tab[aria-disabled='true'],
9894
.tab-neutral[aria-disabled='true'] {
9995
background-color: var(--reactist-tab-neutral-disabled-fill);
10096
color: var(--reactist-tab-neutral-disabled-tint);
10197
cursor: not-allowed;
10298
}
10399

100+
.tab[aria-selected='false']:not([aria-disabled='true']):hover,
101+
.tab-neutral[aria-selected='false']:not([aria-disabled='true']):hover {
102+
background-color: var(--reactist-tab-neutral-hover-fill);
103+
color: var(--reactist-tab-neutral-hover-tint);
104+
}
105+
104106
.tab-themed {
105107
background-color: var(--reactist-tab-themed-unselected-fill);
106108
color: var(--reactist-tab-themed-unselected-tint);
@@ -110,16 +112,16 @@
110112
color: var(--reactist-tab-themed-selected-tint);
111113
}
112114

113-
.tab-themed[aria-selected='false']:hover {
114-
background-color: var(--reactist-tab-themed-hover-fill);
115-
color: var(--reactist-tab-themed-hover-tint);
116-
}
117-
118115
.tab-themed[aria-disabled='true'] {
119116
background-color: var(--reactist-tab-themed-disabled-fill);
120117
color: var(--reactist-tab-themed-disabled-tint);
121118
}
122119

120+
.tab-themed[aria-selected='false']:not([aria-disabled='true']):hover {
121+
background-color: var(--reactist-tab-themed-hover-fill);
122+
color: var(--reactist-tab-themed-hover-tint);
123+
}
124+
123125
.track,
124126
.track-neutral {
125127
background: var(--reactist-tab-neutral-track);

0 commit comments

Comments
 (0)