Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion source/_patterns/02-components/table/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@
tbody th {
background-color: #fff;
position: sticky;
top: -1px;
top: var(
--db-table-top-safe-space,
var(--db-has-fixed-header-height, -1px)
);
}
}
}
2 changes: 2 additions & 0 deletions source/_patterns/02-components/table/table~sticky-header.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ title: Table - sticky header
---

You could set the header cells to appear sticky on scrolling, which is especially useful on longer tables with a lot of rows, by setting the `data-sticky="header"` attribute on the table.

To control the top position which should be taken into account at which the table components header starts to get displayed sticky, you could set the CSS variable `--db-table-top-safe-space`. Elsewhere we take `--db-has-fixed-header-height` to accomplish possible sticky headers being defined for a page. If even also this one isn't set, the default `-1` value would get taken for the calculation.
1 change: 1 addition & 0 deletions source/_patterns/03-areas/_areas.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ body.has-fixed-footer .rea-footer {
}

body.has-fixed-header {
--db-has-fixed-header-height: #{to-rem($pxValue: 70)};
// TODO: using some outsourced global declarations for the headers dimensions (height, padding and margins)
padding-top: to-rem($pxValue: 95);

Expand Down
Loading