@openkfw/design-tokens 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -43,7 +43,41 @@ Licensed under the **Mozilla Public License 2.0 (MPL-2.0)** (the "License"); you
43
43
 
44
44
  ## 💁 FAQ
45
45
 
46
- ### How can I use breakpoint design tokens in Tailwind CSS?
46
+ ### How to use fluid typography with design tokens?
47
+
48
+ Fluid typography allows font sizes to scale dynamically based on the viewport size, creating a responsive and adaptable user experience. KfW Design Tokens include predefined fluid typography settings that you can directly use in your projects.
49
+
50
+ For example, you can apply the following CSS variables with clamp:
51
+
52
+ ```css
53
+ h1 {
54
+ font-size: clamp(var(--kfw-fontsize-heading-1-min), var(--kfw-fontsize-heading-1-val), var(--kfw-fontsize-heading-1-max));
55
+ }
56
+ ```
57
+
58
+ This ensures that the `h1` font size adjusts fluidly between the minimum and maximum values defined in the design tokens, depending on the viewport width — the minimum value on mobile, scaling up to the maximum value on desktop.
59
+
60
+ ### How to use breakpoint design tokens with @media and CSS?
61
+
62
+ Currently, CSS variables cannot be used directly in media query declarations. However, the W3C is working on the [Custom Media Specification](https://www.w3.org/TR/mediaqueries-5/#at-ruledef-custom-media).
63
+ As a workaround, you can extract your variables into @custom-media rules and generate your CSS using the PostCSS plugin `postcss-custom-media`. A sample integration can be found in the `/demo` directory.
64
+ Otherwise you can use the static `px` values provided in the design tokens.
65
+
66
+ ### How to use breakpoint design tokens width @media and Tailwind CSS?
47
67
 
48
68
  In Tailwind CSS v3, you can define breakpoints directly in your `tailwind.config.js` using JavaScript.
49
- In Tailwind CSS v4, you can either use the <a href="https://v3.tailwindcss.com/docs/using-with-preprocessors#using-sass-less-or-stylus">SCSS preprocessor</a> with variables for breakpoints, or use the standard CSS version and define your breakpoints statically in `px` (without variables), since this only affects breakpoints.
69
+ In Tailwind CSS v4, you can either use the <a href="https://v3.tailwindcss.com/docs/using-with-preprocessors#using-sass-less-or-stylus">SCSS preprocessor</a> with variables for breakpoints, or use the standard CSS version with the workaround described above.
70
+
71
+ ### How to use KfW Design Tokens with AI?
72
+
73
+ You can integrate `KfW Design Tokens` with AI tools like [Google Stitch](https://stitch.withgoogle.com/)
74
+ by providing prompts that include specific token values. This helps generate designs aligned with KfW's branding, including colors, typography, and spacing.
75
+
76
+ Example prompt:
77
+
78
+ ```
79
+ Create a modern website design that aligns with the KfW brand provided by KfW Design Tokens:
80
+
81
+ https://github.com/openkfw/design-tokens/blob/main/output/web_stable_10px/css/kfw-design-tokens.light.css
82
+ (Copy the CSS from the link above and paste it here)
83
+ ```
package/output/README.md CHANGED
@@ -21,4 +21,4 @@ In the `/output` directory, you will find all available output formats for Figma
21
21
 
22
22
  - `/web_next_16px`: Use this folder for third-party systems where we cannot influence the REM root value and it corresponds to the standard browser font size of 16px (100%)
23
23
 
24
- Note: A font size of 10px should never be used. Therefore, it is advisable to set the font size in the `<body>` to 1.6rem.
24
+ Note: A font size of 10px should never be used. Therefore, it is advisable to set the font size in the `<html>` to `62.5%` and `<body>` to `1.6rem` (16px).
@@ -132,11 +132,11 @@
132
132
  },
133
133
  "Fontfamily": {
134
134
  "Sans": {
135
- "$value": "'KfW Centro Sans', Arial, Helvetica Neue, Helvetica, sans-serif",
135
+ "$value": "'KfW Centro Sans', system-ui, -apple-system, 'Helvetica Neue', Helvetica, Arial, sans-serif",
136
136
  "$type": "fontFamilies"
137
137
  },
138
138
  "Mono": {
139
- "$value": "ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace",
139
+ "$value": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
140
140
  "$type": "fontFamilies"
141
141
  }
142
142
  },
@@ -506,11 +506,11 @@
506
506
  },
507
507
  "Fontfamily": {
508
508
  "Default": {
509
- "$value": "'KfW Centro Sans', Arial, Helvetica Neue, Helvetica, sans-serif",
509
+ "$value": "'KfW Centro Sans', system-ui, -apple-system, 'Helvetica Neue', Helvetica, Arial, sans-serif",
510
510
  "$type": "fontFamilies"
511
511
  },
512
512
  "Code": {
513
- "$value": "ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace",
513
+ "$value": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
514
514
  "$type": "fontFamilies"
515
515
  }
516
516
  },
@@ -553,16 +553,20 @@
553
553
  "$value": "20px",
554
554
  "$type": "dimension"
555
555
  },
556
- "Introduction": {
557
- "$value": "20px",
556
+ "2xsmall": {
557
+ "$value": "5px",
558
+ "$type": "dimension"
559
+ },
560
+ "Xsmall": {
561
+ "$value": "10px",
558
562
  "$type": "dimension"
559
563
  },
560
564
  "Small": {
561
- "$value": "5px",
565
+ "$value": "15px",
562
566
  "$type": "dimension"
563
567
  },
564
568
  "Large": {
565
- "$value": "15px",
569
+ "$value": "30px",
566
570
  "$type": "dimension"
567
571
  },
568
572
  "Heading-1": {
@@ -678,12 +682,22 @@
678
682
  "$value": "4px",
679
683
  "$type": "borderRadius"
680
684
  },
685
+ "Borderwidth": {
686
+ "Default": {
687
+ "$value": "1px",
688
+ "$type": "borderWidth"
689
+ },
690
+ "Large": {
691
+ "$value": "2px",
692
+ "$type": "borderWidth"
693
+ }
694
+ },
681
695
  "Fontweight": {
682
696
  "Default": {
683
697
  "$value": 400,
684
698
  "$type": "fontWeights"
685
699
  },
686
- "Heading": {
700
+ "Bold": {
687
701
  "$value": 500,
688
702
  "$type": "fontWeights"
689
703
  }