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.
For external, client facing applications.
next.design-system.post.ch/?path=/docs/ebb11274-091b-4cb7-9a3f-3e0451c9a865--docs&story=Default#ebb11274-091b-4cb7-9a3f-3e0451c9a865--default
/?path=/story/ebb11274-091b-4cb7-9a3f-3e0451c9a865--default&full=true
<swisspost-internet-header project="test" environment="int01" language="en" ></swisspost-internet-header>
Name | Description | Default | Control |
---|---|---|---|
Required props | |||
project* | Your project id, previously passed as query string parameter serviceId. string | - | |
Optional props | |||
environment | Target environment. Choose 'int01' for local testing. "dev01""dev02""devs1""int01""int02""prod""test" | 'prod' | - |
language | Initial language to be used. Overrides automatic language detection. "de""en""fr""it"undefined | ||
activeRoute | Set the currently activated route. If there is a link matching this URL in the header, it will be highlighted. Will also highlight partly matching URLs. When set to auto, will use current location.href for comparison. booleanstringundefined | 'auto' | |
fullWidth | Displays the header at full width for full-screen applications booleanundefined | false | |
languageCookieKey | The header uses this cookie to set the language. Disables automatic language detection. stringundefined | - | |
languageLocalStorageKey | The header uses this local storage key to set the language. Disables automatic language selection. stringundefined | 'swisspost-internet-header-language' | - |
login | Toggle the login link (when logged out) or the user widget (when logged in). boolean | true | |
logoutUrl | Override the logout-url provided by the portal config. stringundefined | - | |
meta | Toggle the meta navigation. boolean | true | |
search | Toggle the search button. boolean | true | |
skiplinks | Toggle skiplinks. They help keyboard users to quickly jump to important sections of the page. boolean | true | |
stickyness | Sticky behaviour of the header. "full""main""minimal""none" | 'minimal' | |
Overrides | |||
customConfig | Customize the header config loaded from the post portal. | ||
languageSwitchOverrides | Override the language switch links with custom URLs. Helpful when your application contains sub-pages, and you would like to stay on subpages when the user changes language. | ||
osFlyoutOverrides | Online Services only: Add custom links to the special online service navigation entry | ||
Deprecated | |||
configProxy | DEPRECATED!: Define a proxy URL for the config fetch request. Will be removed in the next major version stringundefined | - | |
events | |||
headerLoaded | Fires when the header has been rendered to the page. void | - | - |
methods | |||
getCurrentLanguage | Get the currently set language as a two letter string ("de", "fr" "it" or "en") getCurrentLanguage() => Promise<'de' | 'fr' | 'it' | 'en' | string> | - | - |
Use the custom-config
property when you need to add your own navigation entries.
The Internet Header supports both flyout (dropdown) and no flyout (simple link) configurations for navigation items.
To create a link without a flyout, simply set the noFlyout
property to true
in your custom configuration.
You can also override the default Online Service Flyout using the osFlyoutOverrides
property, which allows you to add custom columns and links.
next.design-system.post.ch/?path=/docs/ebb11274-091b-4cb7-9a3f-3e0451c9a865--docs&story=Custom Config#ebb11274-091b-4cb7-9a3f-3e0451c9a865--custom-config
/?path=/story/ebb11274-091b-4cb7-9a3f-3e0451c9a865--custom-config&full=true
<swisspost-internet-header project="test" environment="int01" language="en" custom-config='{"de":{"header":{"navMain":[{"title":"Meine Links (custom config)","text":"Meine Links","url":"#","flyout":[{"title":"Google","linkList":[{"url":"https://maps.google.com","title":"Google Maps","target":"_blank"},{"url":"https://translate.google.com","title":"Google Translate"}]}]},{"title":"Mein Link (custom config, no flyout)","text":"Mein Link","url":"#","noFlyout":true}]}},"fr":{"header":{"navMain":[{"title":"Meine Links (custom config)","text":"Meine Links","url":"#","flyout":[{"title":"Google","linkList":[{"url":"https://maps.google.com","title":"Google Maps","target":"_blank"},{"url":"https://translate.google.com","title":"Google Translate"}]}]},{"title":"Mein Link (custom config, no flyout)","text":"Mein Link","url":"#","noFlyout":true}]}},"it":{"header":{"navMain":[{"title":"Meine Links (custom config)","text":"Meine Links","url":"#","flyout":[{"title":"Google","linkList":[{"url":"https://maps.google.com","title":"Google Maps","target":"_blank"},{"url":"https://translate.google.com","title":"Google Translate"}]}]},{"title":"Mein Link (custom config, no flyout)","text":"Mein Link","url":"#","noFlyout":true}]}},"en":{"header":{"navMain":[{"title":"Meine Links (custom config)","text":"Meine Links","url":"#","flyout":[{"title":"Google","linkList":[{"url":"https://maps.google.com","title":"Google Maps","target":"_blank"},{"url":"https://translate.google.com","title":"Google Translate"}]}]},{"title":"Mein Link (custom config, no flyout)","text":"Mein Link","url":"#","noFlyout":true}]}}}' ></swisspost-internet-header>
You can add your own content to the main navigation, this content is displayed next to the search button.
next.design-system.post.ch/?path=/docs/ebb11274-091b-4cb7-9a3f-3e0451c9a865--docs&story=Custom Content#ebb11274-091b-4cb7-9a3f-3e0451c9a865--custom-content
/?path=/story/ebb11274-091b-4cb7-9a3f-3e0451c9a865--custom-content&full=true
Hello, User!
<swisspost-internet-header project="test" environment="int01" language="en" ><p class="mx-16 mb-0" slot="main">Hello, User!</p></swisspost-internet-header >
Customizing where the links in the language switch point to using the language-switch-overrides
property.
next.design-system.post.ch/?path=/docs/ebb11274-091b-4cb7-9a3f-3e0451c9a865--docs&story=Language Switch Overrides#ebb11274-091b-4cb7-9a3f-3e0451c9a865--language-switch-overrides
/?path=/story/ebb11274-091b-4cb7-9a3f-3e0451c9a865--language-switch-overrides&full=true
<swisspost-internet-header project="test" environment="int01" language="en" language-switch-overrides='[{"lang":"de","url":"/?lang=de"},{"lang":"fr","url":"/?lang=fr"},{"lang":"it","url":"/?lang=it"},{"lang":"en","url":"/?lang=en"}]' ></swisspost-internet-header>
Customising the online service flyout using the os-flyout-overrides
property.
next.design-system.post.ch/?path=/docs/ebb11274-091b-4cb7-9a3f-3e0451c9a865--docs&story=OS Flyout Overrides#ebb11274-091b-4cb7-9a3f-3e0451c9a865--os-flyout-overrides
/?path=/story/ebb11274-091b-4cb7-9a3f-3e0451c9a865--os-flyout-overrides&full=true
<swisspost-internet-header project="test" environment="int01" language="en" os-flyout-overrides='{"title":"Custom OS Flyout","text":"Custom OS Flyout","url":"#","flyout":[{"title":"A title","linkList":[{"url":"#bla","title":"Another link"}]},{"title":"Another column","linkList":[{"url":"#foo","title":"Foo"}]}]}' ></swisspost-internet-header>
To access the CSS variables for the header, you need to install an optional stylesheet into your project. Learn more in the header CSS variables stylesheet documentation.
This allows you to implement styling relative to the header.
next.design-system.post.ch/?path=/docs/ebb11274-091b-4cb7-9a3f-3e0451c9a865--docs&story=Css Variables#ebb11274-091b-4cb7-9a3f-3e0451c9a865--css-variables
/?path=/story/ebb11274-091b-4cb7-9a3f-3e0451c9a865--css-variables&full=true
I am sticky! I am always positioned right below the header when you scroll up and down.
<style> #my-div { z-index: 1000; top: 0; transition: var(--post-header-slide-in-transition); } swisspost-internet-header.scrolling-up + #my-div { top: var(--post-header-height); } </style> <swisspost-internet-header project="test" environment="int01" language="en" ></swisspost-internet-header> <p id="my-div" class="position-sticky palette-accent p-16"> I am sticky! I am always positioned right below the header when you scroll up and down. </p>