No Preview

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:

  1. Missing Context/Providers: You can use decorators to supply specific contexts or providers, which are sometimes necessary for components to render correctly. For detailed instructions on using decorators, please visit the Decorators documentation.
  2. Misconfigured Webpack or Vite: Verify that Storybook picks up all necessary settings for loaders, plugins, and other relevant parameters. You can find step-by-step guides for configuring Webpack or Vite with Storybook.
  3. Missing Environment Variables: Your Storybook may require specific environment variables to function as intended. You can set up custom environment variables as outlined in the Environment Variables documentation.

@swisspost/design-system-components

npm version

A set of standard Web Components for easy integration with every framework or no framework at all.
Depending on your project setup, there are different ways available to integrate our components.

npm install @swisspost/design-system-components

Import all or only specific components into your entry file (e.g. main.js, app.js, ...).

import { defineCustomElements as definePostComponents } from '@swisspost/design-system-components/loader'; definePostComponents();
import { defineCustomElement as definePostIcon } from '@swisspost/design-system-components/dist/components/post-icon'; definePostIcon();

Use the imported components in your html:

<post-icon name="1000"></post-icon>

If you are not using any bundler or don't want to install from npm, you can load our components from your favorite CDN. Make sure to replace {version} with the version you want to use or remove @{version} to use the latest version.

Available CDNs:

Lazy-Loaded

Load all components at once

<html> <head> <script type="module"> import { defineCustomElements as definePostComponents } from '{cdnUrl}@{version}/loader/index.js'; definePostComponents(); </script> </head> <body> <post-icon name="1001"></post-icon> </body> </html>

Load specific components only

<html> <head> <script type="module"> import { defineCustomElement as definePostIcon } from '{cdnUrl}@{version}/dist/components/post-icon.js'; definePostIcon(); </script> </head> <body> <post-icon name="1001"></post-icon> </body> </html>
Bare component
<html> <head> <script src="{cdnUrl}@{version}/dist/index.js"></script> </head> <body> <post-icon name="1001"></post-icon> </body> </html>