Sorry, but you either have no stories or none are selected somehow.
If the problem persists, check the browser console, or the terminal you've run Storybook from.
The component failed to render properly, likely due to a configuration issue in Storybook. Here are some common causes and how you can address them:
This is a pre-release version and is not production ready. For new and ongoing projects, please refer to the latest Design System version.
The header for client-facing applications.
The Internet Header is built to support the already existing Portal Configuration used for the old Internet Header.
If you're working on a new project, you probably need a new configuration. Please contact the Post Portal Team.
Integration of header only: contact dm-tec@post.ch
Integration of header and KLP: contact KLP first for integration
Provide these informations to DM Tec:
Internet-header package provide two versions:
All the popular frameworks come with some form of bundler. This makes it easy to use npm packages like the Internet Header as you can import, bundle and deliver the header with your own code.
When working with Angular or any other framework, the easiest installation method is via npm.
npm install @swisspost/internet-header
<!-- index.html --> <body> <swisspost-internet-header project="your-project-id"></swisspost-internet-header> ... </body>
Lazy-Loaded
// main.ts / index.js / ... import { defineCustomElements } from '@swisspost/internet-header/loader'; defineCustomElements();
Bare Component
// main.ts / index.js / ... import '@swisspost/internet-header/dist/swisspost-internet-header/swisspost-internet-header.esm';
If you are not using any bundler or don't want to install from npm, you can load the internet-header
from your favourite CDN.
Make sure to replace {version}
with the version you want to use or remove @{version}
to use the latest version.
Available CDNs:
{cdnURL}
with https://cdn.jsdelivr.net/npm/@swisspost/internet-header.{cdnURL}
with https://unpkg.com/@swisspost/internet-header.Lazy-Loaded
<!DOCTYPE html> <html> <body> <swisspost-internet-header project="your-project-id"></swisspost-internet-header> <script type="module"> import { defineCustomElements } from '{cdnUrl}@{version}/loader/index.es2017.js'; defineCustomElements(); </script> </body> </html>
Bare Component
<!DOCTYPE html> <html> <head> <script async type="module" src="{cdnUrl}@{version}/dist/swisspost-internet-header/swisspost-internet-header.esm.js" ></script> </head> <body> <swisspost-internet-header project="your-project-id"></swisspost-internet-header> </body> </html>
For Angular user, please have a look at How to integrate Web Components inside Angular
The internet header package provides a stylesheet aimed at facilitating the use of key CSS variables beyond the header itself. This stylesheet allows you to access CSS variables to implement styling relative to the header as needed, but it is completely optional.
@use "@swisspost/internet-header/dist/swisspost-internet-header/swisspost-internet-header.css";
<link rel="stylesheet" href="@swisspost/internet-header/dist/swisspost-internet-header/swisspost-internet-header.css"/>
This guide aims to give a broad overview of how a migration can be performed. Different projects have different levels of integration with the header, and therefore require more steps to migrate.
The "new" Internet Header Web Component aims to encapsulate as much as possible whereas the old header had a big influence on the page — limiting design decisions and flexibility of the markup structure. The Web Component Header consists of one script and three standard Web Components that can be freely placed on the page. It's even possible to render those elements with Angular (or any other framework) to easier pass settings into the component.
The new header is built to work with the existing Sitecore configuration already existing for your project to make the migration as smooth as possible.
If you need support during your migration, don't hesitate to contact the Design System Team on GitHub.
In your index.html, you should find three scripts associated with the old header. One to load static assets, one to configure it and one to load it.
serviceid
.staticassets
script to check if you still need it<html> <head> <link rel="stylesheet" href="https://www.post.ch/api/staticasset?serviceId=webstamp&file=post.css&environment=prod" /> <link rel="stylesheet" href="https://www.post.ch/api/staticasset?serviceId=webstamp&file=post-modules.css&environment=prod" /> <!-- Custom CSS --> <!-- static assets --> <script src="https://www.post.ch/api/staticasset?serviceId=webstamp&file=head.js&environment=prod" type="text/javascript" ></script> </head> <body> <div id="os_content"> <!-- Content from the current page of the online service --> </div> <!-- configuration --> <script id="os_config" type="application/json"> { "os_config": { "currentLang": "de", "currentUrl": "https://service.post.ch/onlinedienst/deep-url" } } </script> <!-- loader --> <script src="https://www.post.ch/api/headerjs?serviceid=webstamp&includejquery=true&environment=prod" type="text/javascript" ></script> </body> </html>
The old header was responsible for wrapping your main code (here #os_content
) with custom <div>
s.
The new header does not provide those wrappers.
Instead, every page has control over the main markup structure.
A possible replacement of the above code could be:
<html> <head> <link rel="stylesheet" href="https://www.post.ch/api/staticasset?serviceId=webstamp&file=post.css&environment=prod" /> <link rel="stylesheet" href="https://www.post.ch/api/staticasset?serviceId=webstamp&file=post-modules.css&environment=prod" /> <!-- Custom CSS --> </head> <body> <main id="os_content" class="container"> <!-- Content from the current page of the online service --> </main> </body> </html>
container
around your main content to align it properly in the center.<main>
tag. (Learn more about the <main>
tag).staticasset
stylesheets linked in the headerIf you need to do any other changes, please make a post to the Design System Teams Channel in order to inform the devs to update this guide and provide useful information for other developers.
The new Header does not ship jQuery anymore. While jQuery v3.6 is an internal dependency for the Login Widget, every project is now responsible for loading and updating jQuery individually. If you are depending on an older (<3.5) version of jQuery, please update. There is a long list of known jQuery vulnerabilities.
Please refer to the Internet Header installation instructions for an installation guide.
After installation, you're ready to add the new tags to your markup:
<html> <head> <link rel="stylesheet" href="https://www.post.ch/api/staticasset?serviceId=webstamp&file=post.css&environment=prod" /> <link rel="stylesheet" href="https://www.post.ch/api/staticasset?serviceId=webstamp&file=post-modules.css&environment=prod" /> <!-- Eigene CSS Verknüpfungen --> </head> <body> <!-- The header needs to be directly in the body tag for stickiness functionality to work --> <swisspost-internet-header project="your-service-id"></swisspost-internet-header> <aside class="my-huge-r container"> <swisspost-internet-breadcrumbs></swisspost-internet-breadcrumbs> </aside> <main id="os_content" class="container"> <!-- Content from the current page of the online service --> </main> <swisspost-internet-footer></swisspost-internet-footer> </body> </html>
Place the new elements as described (and needed) as shown above.
The breadcrumbs need a container
wrapper to align themselves with the content of your page,
the header and the footer already provide a container.
If you don't have breadcrumbs, you can just delete the <aside>
and the <swisspost-internet-breadcrumbs>
.
If you need to change settings during runtime, you can get a reference to the header by querying:
const header = document.querySelector<HTMLSwisspostInternetHeaderElement>( 'swisspost-internet-header', ); // Toggle search header.search = false; // Set new custom config header.customConfig = { /* ... */ };
At the Internet Header configuration page you can find a list of possible options.
8020_tiktok
. (by @leagrdv with #5517)color: inherit
with tokens to improve high contrast mode compatability. (by @schaertim with #4933)sessionData
and address
properties in the sessionStorage item klp.widget.state
. If you're looking for this info, contact the Swiss Post Design System Team! (by @oliverschuerch with #4553)hydrated
) to attribute (data-hydrated
). This flag indicates when a component finished rendering on the page. If your tests relied on the class being present, please rewrite the selector to use the new attribute selector. (by @oliverschuerch with #3783):root
CSS custom properties to facilitate implementing styles relative to the header. This will allow putting sticky content right below the header. (by @alizedebray with #3200)Refactored brand colors. Renamed $gray-background
SCSS variable to $gray
and removed $gray-background-light
variable because it is a duplication of the already existing variable $light
.
Updated the usage of said variables in dependant packages accordingly. (by @oliverschuerch with #2861)
Fixed logo not scaled properly for header with no meta navigation. (by @alizedebray with #2787)
Sanitized hours fields in footer against XSS "Incomplete multi-character sanitization" issue. (by @imagoiq with #2807)
Replaced system-ui
fallback font with a list of fallbacks to avoid rendering issues with specific writing system (chinese, arabic…). (by @imagoiq with #2735)
Fixed an issue with invisible focus rings when not using the Design System Styles along with the Swisspost Internet Header. Focus rings are now displayed as expected. (by @gfellerph with #2793)
Fixed display of internet-header icons on high-contrast mode with light theme. (by @imagoiq with #2669)
Improve the main navigation slot placement and styling. (by @alizedebray with #2280)
Defined @stencil/core and @stencil/store as a devDependency to avoid compatibilities issues. (by @imagoiq with #2313)
Fixed position of close button on click or on focus in the help overlay. (by @imagoiq with #2365)
defineCustomElements
. (by @gfellerph with #2208)f74c9662
)Added logout-url property to override the URL provided by the portal config on the internet-header component. (by @imagoiq with #2114)
Added hide-buttons prop to hide all breadcrumbs buttons. (by @imagoiq with #2027)
Fixed internet-header search focus truncated on focus-within. (by @imagoiq with #2043)
Enabled nesting the header in a different scroll container than the <body>
element. The header stickyness and logo animation logic will automatically attach to the nearest scrolling container instead of the document when nested in a container that has overflow: auto | scroll
set. (by @alizedebray with #1855)
Added ability to toggle programmatically an overlay associated with a button using the toggleOverlayById
method. (by @imagoiq with #1838)
Clarified and fixed which internet-header versions are available and how to use them. (by @imagoiq with #1792)
Added a cookie settings button to the footer. Applications with integrated UC_UI (through GTM) will see the button and users will be able to edit their preferences. (by @gfellerph with #1730)
Updated the logo size, the post logo now spans the meta-navigation and scales down on scroll. (by @gfellerph with #1552)
Fixed an issue with uppercase environment strings. Uppercase environment strings caused issues with mapping to datasets throughout the header. Now the property is being converted to lowercase internally. (by @gfellerph with #1670)
Fixed an issue with the search redirect to track and trace. The track and trace API ok
response type changed from boolean to string. The new type is now supported in the redirect logic. (by @gfellerph with #1674)
Added tracking calls to the search recommendations. Click events are being sent to the tag manager if it is present on the page (by @gfellerph with #1548)
Implemented kill-switch for coveo suggestions based on the isCustomSuggestionHidden
option in the search configuration. (by @gfellerph with #1591)
Deprecated the stickyness option "full". It should not be used anymore as this mode takes up too much screen space (by @gfellerph with #1551)
Fixed jobs login widget. An optimized widget is now rendered without requesting the whole KLP widget logic (by @gfellerph with #1568)
Fixed broken links to the storybook documentation. (by @alizedebray with #1514)
Fixed an issue, which causes the autofocus of any element on a page to move instantly to the klp-login-widget button on page load, when a user is logged in. (by @oliverschuerch with #1476)
Fixed an issue with route detection. Uppercase URLs will now correctly match their lowercase navigation item counterparts. (by @gfellerph with #1435)
Fixed the focus behavior when navigating the flyout with a mouse. Hovering and leaving navigation items that trigger a flyout will no longer focus the main navigation entry after the flyout has been closed. (by @gfellerph with #1462)
Added abort controller for all existing post-search search endpoints, to avoid running parallel calls for the same endpoint and therefore get outdated suggestions in the search suggestion list. (by @oliverschuerch with #1416)
Added role="search"
to the post-search component and role="searchbox"
to its search input field. (by @oliverschuerch with #1403)
Added an aria-label attribute on the skiplinks ul element to clearify the usage of the links in the list. (by @oliverschuerch with #1402)
Setting the focus to the related back-button or main-link element whenever a flyout is opened or closed. (by @oliverschuerch with #1404)
Added aria-label
or aria-labelledby
attributes to all <nav>
elements. (by @alizedebray with #1408)
Added invisible text to mark active main navigation point. (by @oliverschuerch with #1401)
Fixed the scroll error in the 2nd-level navigation overlay on mobile devices. (by @oliverschuerch with #1400)
Added current language information in the post-language-switch component. (by @oliverschuerch with #1376)
Added an aria-labelledby
attribute to the flyout link lists to bind them to their title. (by @alizedebray with #1370)
Fixed overlapping of the search input label and the search input icon in the post-search component. (by @oliverschuerch with #1367)
Removed the title
and accessKey
attributes from the skiplinks. (by @alizedebray with #1369)
Added the name of the active menu item to the hidden label of the flyout close button. (by @alizedebray with #1372)
Added aria-label
to the mobile language selector. (by @alizedebray with #1373)
Added an aria-labelledby
attribute to the search suggestion list to bind it to its title. (by @alizedebray with #1371)
Added aria attributes to mobile menu toggle. (by @alizedebray with #1368)
script
tag for Portal specific integrations. A lang
attribute on the html element is required for this solution to work as well as a <script id="PPM_HEADER_DATA" type="application/json">
tag containing the header config for the defined language. (by @gfellerph with #1309)Updated the places search filter. The search now shows adresses, localities and regions in addition to points of interest like Post Branches, MyPost 24 and other Post services. (by @oliverschuerch with #1257)
Improved the styling for the Internet-Header search input. Text in the input does not overlap the start-search-button anymore. (by @oliverschuerch with #1257)
Removed @sindresorhus/slugger as dependency, since it's no longer necessary for creating places.post.ch detail page URLs (by @gfellerph with #1120)
Added more possible environment settings (dev01, dev02, test). (by @gfellerph with #1114)
Fixed heading level for main navigation from h2
to h1
in order to comply to the header level nesting spec. (by @gfellerph with #1123)
Updated skiplinks markup to better match the previous implementation and prevent an unnamed landmark error. Also added a title. (by @gfellerph with #1066)
Updated the styles for the breadcrumb help & contact buttons in order to make the button text accessible for screen readers on mobile (by @gfellerph with #1066)
Fixed an issue with the footer custom config. The header part of the custom config is optional and is now treated as such. (by @gfellerph with #1066)
Fixed environment string comparison when upper case characters are used to define the environment property (by @gfellerph with #1082)
Patched relative URLs for the "most searched services" feature of the search box. Relative URLs are always resolved to the base "https://post.ch" (by @gfellerph with #1011)
Fixed an issue with cross-origin communication between the breadcrumb help and contact overlay iFrames and the host page. Disabled origin checks in the iframeresizer plugin (by @gfellerph with #1008)
Fixed button alignment in the change company dialog (by @gfellerph with #1010)