diff --git a/packages/main/cypress/specs/List.cy.tsx b/packages/main/cypress/specs/List.cy.tsx
index 46e608d738eb..0775f3d7bb89 100644
--- a/packages/main/cypress/specs/List.cy.tsx
+++ b/packages/main/cypress/specs/List.cy.tsx
@@ -12,6 +12,7 @@ import ResponsivePopover from "../../src/ResponsivePopover.js";
import Select from "../../src/Select.js";
import Option from "../../src/Option.js";
import CheckBox from "../../src/CheckBox.js";
+import Bar from "../../src/Bar.js";
function getGrowingWithScrollList(length: number, height: string = "100px") {
return (
@@ -2516,4 +2517,77 @@ describe("List keyboard drag and drop tests", () => {
cy.get("#item9").prev().should("have.id", "item4");
});
+});
+
+describe("List sticky header", () => {
+ it("sticks default header", () => {
+ cy.mount(
+
+ );
+
+ cy.get("#scrollContainer")
+ .as("container");
+
+ cy.get("[ui5-list]")
+ .shadow()
+ .find(".ui5-list-header")
+ .as("header");
+
+ cy.get("@header")
+ .then(($headerBefore) => {
+ const headerTopBefore = $headerBefore[0].getBoundingClientRect().top;
+
+ cy.get("@container")
+ .scrollTo(0, 50);
+
+ cy.get("@header")
+ .should(($headerAfter) => {
+ const headerTopAfter = $headerAfter[0].getBoundingClientRect().top;
+ expect(headerTopAfter).to.eq(headerTopBefore);
+ });
+ });
+ });
+
+ it("sticks custom header", () => {
+ cy.mount(
+
+ );
+
+ cy.get("#scrollContainer")
+ .as("container");
+
+ cy.get("[ui5-bar]")
+ .as("header");
+
+ cy.get("@header")
+ .then(($headerBefore) => {
+ const headerTopBefore = $headerBefore[0].getBoundingClientRect().top;
+
+ cy.get("@container")
+ .scrollTo(0, 50);
+
+ cy.get("@header")
+ .should(($headerAfter) => {
+ const headerTopAfter = $headerAfter[0].getBoundingClientRect().top;
+ expect(headerTopAfter).to.eq(headerTopBefore);
+ });
+ });
+ });
});
\ No newline at end of file
diff --git a/packages/main/src/List.ts b/packages/main/src/List.ts
index 92e881c7cf2a..61e86cb021ce 100644
--- a/packages/main/src/List.ts
+++ b/packages/main/src/List.ts
@@ -396,6 +396,17 @@ class List extends UI5Element {
@property({ type: Number })
loadingDelay = 1000;
+ /**
+ * Indicates whether the List header is sticky or not.
+ * If stickyHeader is set to true, then whenever you scroll the content or
+ * the application, the header of the list will be always visible.
+ * @default false
+ * @public
+ * @since 2.18.0
+ */
+ @property({ type: Boolean })
+ stickyHeader = false;
+
/**
* Defines the accessible name of the component.
* @default undefined
diff --git a/packages/main/src/ListTemplate.tsx b/packages/main/src/ListTemplate.tsx
index ff00c185bc94..c3c0809a1459 100644
--- a/packages/main/src/ListTemplate.tsx
+++ b/packages/main/src/ListTemplate.tsx
@@ -29,9 +29,7 @@ export default function ListTemplate(this: List) {
active={this.showBusyIndicatorOverlay}
class="ui5-list-busy-indicator"
>
-
-