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 official Swiss Post Icon Library with 1020+ high-quality svg icons and the brand new UI Icon Set, exclusively designed and provided for the web with 540+ icons and responsive level-of-detail.
The <post-icon>
element is part of the @swisspost/design-system-components
package.
For more information, read the getting started with components guide.
The SVG files for icons should be hosted within your project. For guidelines on how to set this up, please refer to the icon package documentation.
Our <post-icon>
component renders SVGs, so it scales quickly and easily and can
be styled with CSS.
next.design-system.post.ch/?path=/docs/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--docs&story=Default#0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--default
/?path=/story/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--default&full=true
<post-icon name="1022"></post-icon>
Name | Description | Default | Control |
---|---|---|---|
General | |||
name* | The name/id of the icon (e.g. 1000, 1001, ...). string | ||
base | The base path, where the icons are located (must be a public url). Leave this field empty to use the default cdn url. string | ||
props | |||
flip-h | When set to true , the icon will be flipped horizontally.boolean | false | |
flip-v | When set to true , the icon will be flipped vertically.boolean | false | |
scale | The number for the css scale transformation. number | ||
rotate | The number of degree for the css rotate transformation. number | ||
animation | The name of the animation. "cylon""cylon-vertical""fade""spin""spin-reverse""throb" |
UI icons are responsive and can have a different level-of-detail, depending on how big they are rendered on the page. Use the resize handle in the example to see how the icon changes while you change its size.
next.design-system.post.ch/?path=/docs/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--docs&story=UI#0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--ui
/?path=/story/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--ui&full=true
<post-icon name="accessibility"></post-icon>
By default, icons inherit the current text color of their parent element.
You can therefore colorize an icon by simply changing the color
css property of the element itself.
next.design-system.post.ch/?path=/docs/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--docs&story=Color#0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--color
/?path=/story/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--color&full=true
<post-icon name="1022" style="color: blue"></post-icon ><post-icon name="1022" style="color:#800080"></post-icon ><post-icon name="1022" style="color: rgb(230, 0, 0)"></post-icon>
Icons have a default width
of 1em
, which means they will scale with the size of the current font-size
css property.
next.design-system.post.ch/?path=/docs/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--docs&story=Size#0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--size
/?path=/story/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--size&full=true
<post-icon name="1022" style="font-size: 1rem"></post-icon ><post-icon name="1022" style="font-size: 3rem"></post-icon ><post-icon name="1022" style="font-size: 6rem"></post-icon>
The following examples are available by default only in the <post-icon>
web-component. To do something similar with the CSS mixin, you would need to use the transform
property or add your own css animations.
Flip the icon horizontally and/or vertically with the flip-h
and flip-v
props.
next.design-system.post.ch/?path=/docs/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--docs&story=Flip#0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--flip
/?path=/story/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--flip&full=true
<post-icon name="1022"></post-icon><post-icon name="1022" flip-h="true"></post-icon ><post-icon name="1022" flip-v="true"></post-icon ><post-icon name="1022" flip-h="true" flip-v="true"></post-icon>
Scale the icon by any positive factor via the scale
prop. Note this changes the icon's visual size but not its physical font size. To illustrate this we have added a background color to the icons.
next.design-system.post.ch/?path=/docs/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--docs&story=Scale#0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--scale
/?path=/story/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--scale&full=true
<post-icon name="1022" scale="0.5"></post-icon><post-icon name="1022"></post-icon ><post-icon name="1022" scale="1.5"></post-icon>
Rotate the icon by a number of degrees with the rotate
prop. Positive values will rotate the icon clockwise, while negative values will rotate the icon counterclockwise.
next.design-system.post.ch/?path=/docs/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--docs&story=Rotate#0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--rotate
/?path=/story/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--rotate&full=true
<post-icon name="1022" rotate="-365"></post-icon><post-icon name="1022" rotate="-249"></post-icon ><post-icon name="1022" rotate="-35.5"></post-icon><post-icon name="1022" rotate="0"></post-icon ><post-icon name="1022" rotate="98"></post-icon><post-icon name="1022" rotate="365"></post-icon ><post-icon name="1022" rotate="753"></post-icon>
The post-icon
includes the following built-in animations for icons:
cylon
slides the icon left and rightcylon-vertical
slides the icon up and downspin
smoothly spins the icon clockwisespin-reverse
smoothly spins the icon counter-clockwisefade
fades the icon in and outthrob
scales the icon in and outTo use them, set the animation
prop to one of the animation names above.
next.design-system.post.ch/?path=/docs/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--docs&story=Animate#0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--animate
/?path=/story/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--animate&full=true
Animation: cylon
Animation: cylon-vertical
Animation: spin
Animation: spin-reverse
Animation: fade
Animation: throb
<div class="w-half py-16"> <p class="text-muted fs-9">Animation: cylon</p> <post-icon name="2253" animation="cylon"></post-icon> </div> <div class="w-half py-16"> <p class="text-muted fs-9">Animation: cylon-vertical</p> <post-icon name="2252" animation="cylon-vertical"></post-icon> </div> <div class="w-half py-16"> <p class="text-muted fs-9">Animation: spin</p> <post-icon name="2041" animation="spin"></post-icon> </div> <div class="w-half py-16"> <p class="text-muted fs-9">Animation: spin-reverse</p> <post-icon name="2042" animation="spin-reverse"></post-icon> </div> <div class="w-half py-16"> <p class="text-muted fs-9">Animation: fade</p> <post-icon name="2151" animation="fade"></post-icon> </div> <div class="w-half py-16"> <p class="text-muted fs-9">Animation: throb</p> <post-icon name="2063" animation="throb"></post-icon> </div>
To define an icon in your own CSS, you need the @swisspost/design-system-styles
package and use our post-icon
mixin. The icons are responsive and can have a different level-of-detail, depending on how big they are rendered on the page.
next.design-system.post.ch/?path=/docs/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--docs&story=CSS Default#0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--css-default
/?path=/story/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--css-default&full=true
<div class="my-1022-icon"></div>
UI icons are responsive and can have a different level-of-detail, depending on how big they are rendered on the page. Use the resize handle in the example to see how the icon changes while you change its size.
next.design-system.post.ch/?path=/docs/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--docs&story=CSS UI#0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--css-ui
/?path=/story/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--css-ui&full=true
<div class="my-accessibility-icon"></div>
By default, icons inherit the current text color of their parent element.
You can therefore colorize an icon by simply changing the color
css property of the element itself.
next.design-system.post.ch/?path=/docs/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--docs&story=CSS Color#0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--css-color
/?path=/story/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--css-color&full=true
<div class="my-1022-icon" style="color: blue"></div>
Icons have a default width
of 1em
, which means they will scale with the size of the current font-size
css property.
next.design-system.post.ch/?path=/docs/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--docs&story=CSS Size#0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--css-size
/?path=/story/0dcfe3c0-bfc0-4107-b43b-7e9d825b805f--css-size&full=true
<div class="my-1022-icon" style="font-size: 3rem"></div>
@use '@swisspost/design-system-styles/core' as post; .my-icon { @include post.post-icon( $name: 'accessibility', // optional $base: '/optional/path/to/your/self-hosted/svgs', // optional $color: '#fc0' ); }
Showing 1024 of 1024 icons.