From 4f4d1a2eef50424b2d178444ac9ee7c5ad3b9001 Mon Sep 17 00:00:00 2001 From: Nikolay Deshev Date: Thu, 21 May 2026 16:40:31 +0300 Subject: [PATCH] feat(ui5-panel): expose header-wrapper part a 'header-wrapper' part is added to allow apps to style the outermost header wrapper, useful for adjusting sticky header position. Related to: #13392 --- packages/main/src/Panel.ts | 3 +- packages/main/src/PanelTemplate.tsx | 1 + packages/main/test/pages/Panel.html | 34 +++++++++++++++++++++++ packages/main/test/pages/styles/Panel.css | 31 +++++++++++++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/packages/main/src/Panel.ts b/packages/main/src/Panel.ts index ec95b96ea1e3e..881664e052e9b 100644 --- a/packages/main/src/Panel.ts +++ b/packages/main/src/Panel.ts @@ -77,7 +77,8 @@ import panelCss from "./generated/themes/Panel.css.js"; * @extends UI5Element * @public * @slot {Array} default - Defines the content of the component. The content is visible only when the component is expanded. - * @csspart header - Used to style the wrapper of the header. + * @csspart header-wrapper - Used to style the outermost header wrapper, useful for adjusting sticky header position. + * @csspart header - Used to style the header. * @csspart content - Used to style the wrapper of the content. */ @customElement({ diff --git a/packages/main/src/PanelTemplate.tsx b/packages/main/src/PanelTemplate.tsx index e87a079889537..a75321880e20e 100644 --- a/packages/main/src/PanelTemplate.tsx +++ b/packages/main/src/PanelTemplate.tsx @@ -21,6 +21,7 @@ export default function PanelTemplate(this: Panel) { }} role={this.headingWrapperRole} aria-level={this.headingWrapperAriaLevel} + part="header-wrapper" >
+
+ +
+ Sticky Header with Custom Top Offset Demo +

The container below has a fixed toolbar at the top. The panel's sticky header uses ::part(header-wrapper) { top: 50px } to stick below the toolbar.

+ +
+
Fixed Toolbar (50px)
+
+ + + + Scroll this container to see the sticky header stick at 50px from the top (below the toolbar). + Lorem ipsum dolor sit amet, tamquam invidunt cu sed, unum regione mel ea, quo ea alia novum. Ne qui illud zril + nostrum, vel ea sint dicant postea. Vel ne facete tritani, neglegentur concludaturque sed te. His animal dolorum ut. + Aeterno appareat ei mei, cu sed elit scripserit, an quodsi oportere accusamus quo. Pri ea probo corpora rationibus, + soluta incorrupte ex his. + Mei ei brute cetero, id duo magna aeque torquatos. Quodsi erroribus mediocritatem his ut, ad pri legere iracundia + democritum. Menandri intellegam in mea, ex vero movet qualisque sed. Maiorum verterem perfecto nec ea, est velit + elaboraret consequuntur eu, eam ad reque postea admodum. Ne inimicus convenire pri, doctus vidisse te ius. + Percipitur contentiones in vis, cu vim propriae phaedrum. Has ad magna errem honestatis, duo vero graeco epicurei + no, populo semper sit ne. Vulputate dissentiunt interpretaris ea vis, nec civibus moderatius at. Cu vim stet + dissentias, no vidit saperet indoctum nec, et pro magna prima nobis. Vis consul feugiat qualisque in, regione + persecuti cotidieque id eos, id ius omnesque vituperata. + Pri ex impedit percipit consulatu. Ius iudico feugiat instructior an. Iusto putant eum eu, ubique splendide pri ad, + cu qui salutandi assentior percipitur. At esse ceteros salutandi ius. Te dicam reprehendunt nec, ea discere ponderum + sensibus duo. Vis cu commodo definiebas, postea dissentias ne vim. Modo homero eos ad. Ut vix equidem temporibus. + + + +
+
+
+
diff --git a/packages/main/test/pages/styles/Panel.css b/packages/main/test/pages/styles/Panel.css index 8db2d2f161b8c..8b55904d90fac 100644 --- a/packages/main/test/pages/styles/Panel.css +++ b/packages/main/test/pages/styles/Panel.css @@ -14,4 +14,35 @@ #panel-expandable::part(header) { color: green; +} + +#sticky-demo-container { + position: relative; + height: 300px; + border: 1px solid #ccc; +} + +#sticky-demo-toolbar { + position: sticky; + top: 0; + height: 50px; + background: #0854a0; + color: white; + display: flex; + align-items: center; + padding: 0 1rem; + z-index: 2; +} + +#sticky-demo-scroll-area { + height: 250px; + overflow: auto; +} + +#panel-stickyHeader-customTop::part(header-wrapper) { + top: 50px; +} + +#panel-stickyHeader-customTop::part(content) { + padding-top: 50px; } \ No newline at end of file