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:
The comprehensive collection of Swiss Post icons.
npm install @swisspost/design-system-icons
To render an icon with a component, you need to install the Components package as well.
First you need to make the icons available in your web application.
This basically means that you need to copy & paste them manually or automatically from the node_modules
folder to a served folder in your project.
The way to do this strongly depends on your project setup.
Read on to find out what the possible solutions look like...
See Getting started with Angular
Add a postinstall
script to your package.json
, to copy & paste the icons to a public folder within your web project.
If you want to know more about pre & post scripts and how they are handled, please read the npm documentation.
// package.json { "scripts": { "postinstall": "node -e \"const fs = require('fs'); fs.cpSync('node_modules/@swisspost/design-system-icons/public/post-icons', 'assets/post-icons', { recursive: true }, (err) => { if (err) throw err; });\"" } }
// package.json { "scripts": { "postinstall": "node postinstall-icons.js" } }
// postinstall-icons.js const fse = require('fs-extra'); const srcDir = 'node_modules/@swisspost/design-system-icons/public/post-icons'; const destDir = 'assets/post-icons'; // To copy a folder or file, select overwrite accordingly try { fse.copySync(srcDir, destDir, { overwrite: true }); console.log('Icons successfully copied!'); } catch (err) { console.error(err); }
Now that you have the icons available in your project, you need to tell the icon
component where to find them.
You can do this with two different solutions:
base-path
globally for all icons on the page.base-path
on every icon
component. This can also be used to overwrite the global base-path
for a single icon.<html> <head> <meta name="design-system-settings" data-post-icon-base="/assets/post-icons" /> </head> </html>
<post-icon name="1000" base="/base-path/to/your/own/icon-folder"></post-icon>
There is one last thing we want to tell you about.
All icons are also available from a CDN, which is the default if you don't configure a base path for your icons and don't serve them locally. When using the CDN, please note that you need to configure your CORS policy to enable resource loading from unpkg.com.
Using the CDN is not recommended for production because of higher latency when loading from the CDN, use it for quickly testing something or for prototyping.
If your project includes the Content-Security-Policy response header (usually in index.html
),
make sure that default-src
is set to 'self'
. In case you are using the <post-icon>
component you need to add https://unpkg.com/
to the connect-src
in index.html. This is becasue the icons are retrived from there.