Design Tokens

Design tokens are the named, reusable decisions of SDX: one shared language for Figma and code.

The following predefined CSS Variables (custom properties) can be used to leverage design tokens in your project.

Every token is available as a CSS variable named --sdx- plus the token path with dashes. For example, color.text.body becomes --sdx-color-text-body and spacing.gap.md becomes --sdx-spacing-gap-md. Use the semantic tokens (for example color.text.*, color.background.*, spacing.*) in your code, not the base colour scales.

 

Border Radii

 

Border Widths

 

Background colours

 

Border colours

 

Icon colours

 

Shadows

 

Text colours

 

Letter spacing

 

Line heights

 

Font Size

 

Font weight

 

Icon Size

 

Spacing

 

Validation

To ensure your project only uses officially supported SDX CSS variables, you can run the sdxcheck.js script. The script scans your source files for var(--sdx-*) usages and verifies that each variable exists in the official SDX stylesheet.

 

Setup

Add the validation script to your project, thus CSS variables are checked automatically before the build runs:


                                                        
                                                        
                                                            {
                                                          "scripts": {
                                                            "prebuild": "node node_modules/@swisscom/sdx/dist/scripts/sdxcheck.js",
                                                          }
                                                        }