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
8 changes: 2 additions & 6 deletions src/patternfly/components/Table/examples/Table.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@
#ws-core-c-table-nested-column-headers-sticky-header .ws-preview-html,
#ws-core-c-table-sticky-header .ws-preview-html,
#ws-core-c-table-sticky-footer .ws-preview-html,
#ws-core-c-table-sticky-header-with-base-and-stuck .ws-preview-html {
#ws-core-c-table-sticky-header-with-base-and-stuck .ws-preview-html,
#ws-core-c-table-sticky-footer-with-base-and-stuck .ws-preview-html {
height: 400px;
}

#ws-core-c-table-sticky-header .ws-preview-html,
#ws-core-c-table-sticky-footer .ws-preview-html {
overflow: auto;
}

.pf-v6-c-overflow-menu .pf-v6-c-menu {
position: absolute;
inset-inline-end: 0;
Expand Down
175 changes: 172 additions & 3 deletions src/patternfly/components/Table/examples/Table.md
Original file line number Diff line number Diff line change
Expand Up @@ -3785,6 +3785,7 @@ This example shows the use of `.pf-m-sticky-header-base` and `.pf-m-sticky-heade

### Sticky footer
```hbs
<div class="pf-v6-c-scroll-inner-wrapper">
{{#> table table--id="table-sticky-footer" table--IsGrid=true table--modifier="pf-m-grid-md" table--HasStickyFooter=true table--attribute='aria-label="This is a table with a sticky footer"'}}
{{#> table-thead}}
{{#> table-tr}}
Expand Down Expand Up @@ -3963,25 +3964,193 @@ This example shows the use of `.pf-m-sticky-header-base` and `.pf-m-sticky-heade
{{/table-tr}}
{{/table-tfoot}}
{{/table}}
</div>
```

### Sticky footer with base and stuck

This example uses `.pf-m-sticky-footer-base` for sticky positioning without sticky styling. Apply `.pf-m-sticky-footer-stuck` dynamically while the footer is stuck and floating above the table content, and remove it when the footer reaches the bottom of the table so it returns to a normal row.
This example uses `.pf-m-sticky-footer-base` and `.pf-m-sticky-footer-stuck` for sticky positioning. Apply `.pf-m-sticky-footer-stuck` dynamically while the footer is stuck and floating above the table content, and remove it when the footer reaches the bottom of the table so it returns to a normal row.

```hbs
<div class="pf-v6-c-scroll-inner-wrapper">
{{#> table table--IsGrid=true table--modifier="pf-m-grid-md" table--HasStickyFooterBase=true table--HasStickyFooterStuck=true table--attribute='aria-label="This is a table with a sticky footer using base and stuck"'}}
{{#> table-thead}}
{{#> table-tr}}
{{#> table-th table-th--attribute='scope="col"'}}
Repositories
{{/table-th}}
{{#> table-th table-th--attribute='scope="col"'}}
Branches
{{/table-th}}
{{#> table-th table-th--attribute='scope="col"'}}
Pull requests
{{/table-th}}
{{#> table-th table-th--attribute='scope="col"'}}
Workspaces
{{/table-th}}
{{#> table-th table-th--attribute='scope="col"'}}
Last commit
{{/table-th}}
{{/table-tr}}
{{/table-thead}}

{{#> table-tbody}}
{{#> table-tr}}
{{#> table-td}}Table content{{/table-td}}
{{#> table-td table-td--data-label="Repository name"}}
Repository 1
{{/table-td}}
{{#> table-td table-td--data-label="Branches"}}
10
{{/table-td}}
{{#> table-td table-td--data-label="Pull requests"}}
25
{{/table-td}}
{{#> table-td table-td--data-label="Workspaces"}}
5
{{/table-td}}
{{#> table-td table-td--data-label="Last commit"}}
2 days ago
{{/table-td}}
{{/table-tr}}

{{#> table-tr}}
{{#> table-td table-td--data-label="Repository name"}}
Repository 2
{{/table-td}}
{{#> table-td table-td--data-label="Branches"}}
10
{{/table-td}}
{{#> table-td table-td--data-label="Pull requests"}}
25
{{/table-td}}
{{#> table-td table-td--data-label="Workspaces"}}
5
{{/table-td}}
{{#> table-td table-td--data-label="Last commit"}}
2 days ago
{{/table-td}}
{{/table-tr}}

{{#> table-tr}}
{{#> table-td table-td--data-label="Repository name"}}
Repository 3
{{/table-td}}
{{#> table-td table-td--data-label="Branches"}}
10
{{/table-td}}
{{#> table-td table-td--data-label="Pull requests"}}
25
{{/table-td}}
{{#> table-td table-td--data-label="Workspaces"}}
5
{{/table-td}}
{{#> table-td table-td--data-label="Last commit"}}
2 days ago
{{/table-td}}
{{/table-tr}}

{{#> table-tr}}
{{#> table-td table-td--data-label="Repository name"}}
Repository 4
{{/table-td}}
{{#> table-td table-td--data-label="Branches"}}
10
{{/table-td}}
{{#> table-td table-td--data-label="Pull requests"}}
25
{{/table-td}}
{{#> table-td table-td--data-label="Workspaces"}}
5
{{/table-td}}
{{#> table-td table-td--data-label="Last commit"}}
2 days ago
{{/table-td}}
{{/table-tr}}

{{#> table-tr}}
{{#> table-td table-td--data-label="Repository name"}}
Repository 5
{{/table-td}}
{{#> table-td table-td--data-label="Branches"}}
10
{{/table-td}}
{{#> table-td table-td--data-label="Pull requests"}}
25
{{/table-td}}
{{#> table-td table-td--data-label="Workspaces"}}
5
{{/table-td}}
{{#> table-td table-td--data-label="Last commit"}}
2 days ago
{{/table-td}}
{{/table-tr}}

{{#> table-tr}}
{{#> table-td table-td--data-label="Repository name"}}
Repository 6
{{/table-td}}
{{#> table-td table-td--data-label="Branches"}}
10
{{/table-td}}
{{#> table-td table-td--data-label="Pull requests"}}
25
{{/table-td}}
{{#> table-td table-td--data-label="Workspaces"}}
5
{{/table-td}}
{{#> table-td table-td--data-label="Last commit"}}
2 days ago
{{/table-td}}
{{/table-tr}}

{{#> table-tr}}
{{#> table-td table-td--data-label="Repository name"}}
Repository 7
{{/table-td}}
{{#> table-td table-td--data-label="Branches"}}
10
{{/table-td}}
{{#> table-td table-td--data-label="Pull requests"}}
25
{{/table-td}}
{{#> table-td table-td--data-label="Workspaces"}}
5
{{/table-td}}
{{#> table-td table-td--data-label="Last commit"}}
2 days ago
{{/table-td}}
{{/table-tr}}

{{#> table-tr}}
{{#> table-td table-td--data-label="Repository name"}}
Repository 8
{{/table-td}}
{{#> table-td table-td--data-label="Branches"}}
10
{{/table-td}}
{{#> table-td table-td--data-label="Pull requests"}}
25
{{/table-td}}
{{#> table-td table-td--data-label="Workspaces"}}
5
{{/table-td}}
{{#> table-td table-td--data-label="Last commit"}}
2 days ago
{{/table-td}}
{{/table-tr}}
{{/table-tbody}}
{{#> table-tfoot}}
{{#> table-tr}}
{{#> table-th table-th--attribute='scope="row"'}}Total{{/table-th}}
{{#> table-th table-th--attribute='scope="row"'}}
Total
{{/table-th}}
{{#> table-td table-td--attribute='colspan="4"'}}
4
{{/table-td}}
{{/table-tr}}
{{/table-tfoot}}
{{/table}}
</div>
```

### Sticky column
Expand Down
39 changes: 10 additions & 29 deletions src/patternfly/components/Table/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@
--#{$table}--m-sticky-header--BoxShadow: var(--#{$table}--m-sticky-header--BoxShadow--glass);
--#{$table}--m-sticky-header--BorderRadius: var(--#{$table}--m-sticky-header--BorderRadius--glass);
--#{$table}--m-sticky-footer--BorderBlockStartWidth: 0;
--#{$table}--m-sticky-footer-stuck--BoxShadow: var(--#{$table}--m-sticky-footer--BoxShadow--glass);
--#{$table}--m-sticky-footer-stuck--BorderRadius: var(--#{$table}--m-sticky-footer--BorderRadius--glass);
--#{$table}--m-sticky-footer--BoxShadow: var(--#{$table}--m-sticky-footer--BoxShadow--glass);
--#{$table}--m-sticky-footer--BorderRadius: var(--#{$table}--m-sticky-footer--BorderRadius--glass);
}
}

Expand Down Expand Up @@ -357,7 +357,6 @@
border-radius: var(--#{$table}--m-sticky-header--BorderRadius);
box-shadow: var(--#{$table}--m-sticky-header--BoxShadow);
}


.#{$table}__th::after {
position: absolute;
Expand Down Expand Up @@ -426,6 +425,13 @@
}
}

&.pf-m-sticky-footer,
&.pf-m-sticky-footer-stuck {
> .#{$table}__tbody:last-of-type > .#{$table}__tr:last-of-type {
border-block-end-color: transparent;
}
}

&.pf-m-sticky-footer,
&.pf-m-sticky-footer-base {
> .#{$table}__tfoot {
Expand All @@ -434,7 +440,7 @@
z-index: var(--#{$table}--m-sticky-footer--ZIndex);
background: transparent;

&::before {
&::after {
position: absolute;
inset: 0;
z-index: -1;
Expand Down Expand Up @@ -468,31 +474,6 @@
border-end-end-radius: var(--#{$table}--m-sticky-footer--BorderRadius);
}
}

> .#{$table}__tbody:last-of-type > .#{$table}__tr:last-of-type {
border-block-end: 0;
}
}

&.pf-m-sticky-footer-stuck {
--#{$table}--m-sticky-footer--BoxShadow: var(--#{$table}--m-sticky-footer-stuck--BoxShadow);
--#{$table}--m-sticky-footer--BorderRadius: var(--#{$table}--m-sticky-footer-stuck--BorderRadius);

> .#{$table}__tfoot::before {
opacity: 1;
}
}

&.pf-m-sticky-footer:not(.pf-m-sticky-footer-base) {
--#{$table}--m-sticky-footer--BoxShadow: var(--#{$table}--m-sticky-footer-stuck--BoxShadow);
--#{$table}--m-sticky-footer--BorderRadius: var(--#{$table}--m-sticky-footer-stuck--BorderRadius);

> .#{$table}__tfoot,
> .#{$table}__tfoot :is(.#{$table}__th, .#{$table}__td) {
&::after {
opacity: 1;
}
}
}

// - Table plain
Expand Down
Loading