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.

This is a pre-release version and is not production ready. For new and ongoing projects, please refer to the latest Design System version.

Elevation

Elevation uses box shadows to give the impression of a distance between two elements along the z-axis.

The higher the elevation, the larger and softer the shadow, expressing a greater distance between an element and the one behind it.

elevation none

Class
.elevation-none
Sass
post.$elevation-none

elevation 100

Class
.elevation-100
Sass
post.$elevation-100

elevation 200

Class
.elevation-200
Sass
post.$elevation-200

elevation 300

Class
.elevation-300
Sass
post.$elevation-300

elevation 400

Class
.elevation-400
Sass
post.$elevation-400

elevation 500

Class
.elevation-500
Sass
post.$elevation-500

The easiest way to add an elevation to an element is to apply an elevation class to it.

I'm elevated!
<div class="w-half rounded p-16 elevation-500">I'm elevated!</div>

Import the elevation variables from the Design System Styles package from the core sass file with @use. This way, the elevation variables are scoped and don't mix with your own variables.

@use '../../../../node_modules/@swisspost/design-system-styles/core' as post; .elevated-element { box-shadow: post.$elevation-500; }