Fix striped tables to respect custom row and cell backgrounds (#2623)

This commit is contained in:
Bartosz-Do authored and GitHub committed 2026-09-17 00:01:22 +02:00
1 parent a65771caa7
commit 61b492e449
4 files changed
+16 -2

No files matched your search

@@ -0,0 +1,5 @@
---
"@tabler/core": patch
---
Fixed `.table-striped` and `.table-striped-columns` overriding a row or cell that sets its own background. A `<tr>` or `<td>` carrying `.bg-*`, `.table-*`, `.text-bg-*` or an inline `background` now keeps that background instead of being repainted by the stripe.
+2
View File
@@ -1808,6 +1808,8 @@ $table-striped-bg-factor: 0.05 !default;
$table-striped-order: even !default; $table-striped-order: even !default;
$table-striped-bg: var(--bg-surface-tertiary) !default; $table-striped-bg: var(--bg-surface-tertiary) !default;
$table-striped-columns-order: even !default; $table-striped-columns-order: even !default;
// Rows and cells matching this selector keep their own background instead of the stripe.
$table-striped-exclude-selector: '[class^="bg-"], [class*=" bg-"], [class^="table-"], [class*=" table-"], [class^="text-bg-"], [class*=" text-bg-"], [style*="background"]' !default;
$table-group-separator-color: var(--border-color-translucent) !default; $table-group-separator-color: var(--border-color-translucent) !default;
+5 -2
View File
@@ -109,10 +109,13 @@
// Zebra-striping // Zebra-striping
// //
// Default zebra-stripe styles (alternating gray and transparent backgrounds) // Default zebra-stripe styles (alternating gray and transparent backgrounds)
//
// A row or cell that declares its own background wins over the stripe, so
// `.bg-*`, `.table-*`, `.text-bg-*` and inline backgrounds stay visible.
// For rows // For rows
.table-striped { .table-striped {
> tbody > tr:nth-of-type(#{$table-striped-order}) > * { > tbody > tr:nth-of-type(#{$table-striped-order}):not(:is(#{$table-striped-exclude-selector})) > *:not(:is(#{$table-striped-exclude-selector})) {
--table-color-type: var(--table-striped-color); --table-color-type: var(--table-striped-color);
--table-bg-type: var(--table-striped-bg); --table-bg-type: var(--table-striped-bg);
} }
@@ -120,7 +123,7 @@
// For columns // For columns
.table-striped-columns { .table-striped-columns {
> :not(caption) > tr > :nth-child(#{$table-striped-columns-order}) { > :not(caption) > tr:not(:is(#{$table-striped-exclude-selector})) > :nth-child(#{$table-striped-columns-order}):not(:is(#{$table-striped-exclude-selector})) {
--table-color-type: var(--table-striped-color); --table-color-type: var(--table-striped-color);
--table-bg-type: var(--table-striped-bg); --table-bg-type: var(--table-striped-bg);
} }
+4
View File
@@ -32,6 +32,10 @@
.table { .table {
margin-bottom: 0; margin-bottom: 0;
} }
+ .card-footer {
border-top: 0;
}
} }
.table-transparent { .table-transparent {