2.0.0 • Published 5 months ago

@rijkshuisstijl-community/design-tokens v2.0.0

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
5 months ago

Rijkshuisstijl design tokens

Dit project wordt niet gesteund door het Ministerie van Algemene Zaken.

Het toepassen van design-elementen uit dit project is strikt verboden voor organisaties die geen deel uitmaken van de centrale overheid van Nederland.

Dit project maakt deel uit van een samenwerkingsverband om NL Design System-componenten te gebruiken voor projecten die moeten voldoen aan de Rijkshuisstijl. Organisaties van de centrale overheid van Nederland (bijvoorbeeld: Belastingdienst, DUO, Logius, SVB) en degenen die door hen zijn ingehuurd voor het ontwikkelen van websites en apps, kunnen via dit project samenwerken.

Tokens gebruiken in eigen project

Hieronder vind je instructies hoe je de standaard Rijkshuisstijl-community tokens in je project kan toepassen.

  1. Installeer je het design-tokens npm package.

    npm install --save-dev @rijkshuisstijl-community/design-tokens
    
    # En als je CSS classes wilt importeren
    npm install --save-dev @rijkshuisstijl-community/components-css

    Dit pakket bevat de CSS-variabelen van het design systeem. Importeer het index.css-bestand uit de dist map van het pakket, en omring het deel van je applicatie waar je het thema wilt toepassen. Het Rijkshuisstijl-thema is bijvoorbeeld: rhc-theme.

  2. Pas het thema toe in je project, hieronder een voorbeeld in HTML

    <!-- Als je het default Rijkshuisstijl community thema wilt gebruiken, gebruik .rhc-theme -->
    <link rel="stylesheet" href="node_modules/@rijkshuisstijl-community/design-tokens/dist/index.css" />
    <!-- Of als je een eigen thema wilt importeren, gebruik het thema naam als class name -->
    <link rel="stylesheet" href="@rijkshuisstijl-community/design-tokens/dist/<thema naam>/index.css" />
    <!-- Mogelijk wil je ook de CSS classes importeren als je Rijkshuijsstijl-community componenten gebruikt -->
    <link rel="stylesheet" href="node_modules/@rijkshuisstijl-community/components-css/dist/index.css" />
    
    <body class="rhc-theme">
        <button class="rhc-button">Click Here!</button>
      </div>
    </body>

Nieuw thema toevoegen

Er zijn al verschillende bedrijfsthema's in de @rijkshuisstijl-community/design-tokens package waarvoor (gedeeltelijke) support is vanuit de Rijkshuisstijl-community. Hieronder volgt een uitleg hoe nog meer thema's kunnen worden toegevoegd

Nieuwe thema tokens

  1. Voeg de nieuwe tokens toe aan het design tokens bestand. Mogelijk is het voor designers handiger om dit direct in Figma te doen. Zie hieronder in hoe je een thema direct in JSON toe kan voegen:

    {
      // ...
    
      // Definieer specifieke set tokens die je wilt overschrijven met een duidelijke naam. Voeg indien nodig meerdere overwrites sets toe.
      "overwrites/primaire kleur/mintgroen": {
        // Geef aan welke tokens overschreven moeten worden
        "rhc": {
          "color": {
            "primary": {
              "50": {
                "value": "{rhc.color.mintgroen.50}",
                "type": "color"
              },
              "100": {
                "value": "{rhc.color.mintgroen.100}",
                "type": "color"
              },
              "200": {
                "value": "{rhc.color.mintgroen.200}",
                "type": "color"
              },
              "300": {
                "value": "{rhc.color.mintgroen.300}",
                "type": "color"
              },
              "400": {
                "value": "{rhc.color.mintgroen.400}",
                "type": "color"
              },
              "500": {
                "value": "{rhc.color.mintgroen.500}",
                "type": "color"
              },
              "hover": {
                "value": "{rhc.color.primary.500}",
                "type": "color",
                "$extensions": {
                  "studio.tokens": {
                    "modify": {
                      "type": "darken",
                      "value": "0.3",
                      "space": "lch"
                    }
                  }
                }
              }
            }
          }
        }
      },
      // Nog een overwrite
      "overwrites/border/geen border radius": {
        "rhc": {
          "border-radius": {
            "sm": {
              "value": "0",
              "type": "borderRadius"
            },
            "md": {
              "value": "0",
              "type": "borderRadius"
            },
            "lg": {
              "value": "0",
              "type": "borderRadius"
            }
          }
        }
      },
      // ...
    
      "$themes": [
        // ...
        {
          "id": "<thema ID>", // Wordt niet gebruikt door een build step, maar wel voor Figma
          "name": "<thema naam>", // Dit wordt ook de class name voor het thema
          "$figmaStyleReferences": {},
          "selectedTokenSets": {
            // Voeg eerst de sets toe die dit thema support
            "<token set 1>": "enabled",
            "<token set 2>": "enabled",
            "<etcetera...>": "enabled",
            // Voeg daarna de overwrites toe die je wilt toevoegen aan je thema
            "overwrites/primaire kleur/mintgroen": "enabled",
            "overwrites/border/geen border radius": "enabled"
          }
        }
      ]
    }
  2. Voeg het nieuwe thema toe in de storybook preview.tsx

    // ...
    // Voeg import toe
    import '@rijkshuisstijl-community/design-tokens/dist/<thema naam>/index.css';
    // ...
    
    const preview: Preview = {
      decorators: [
        withThemeByClassName({
          themes: {
            // Voeg thema toe in storybook thema dropdown
            '<Thema naam in dropdown>': '<thema naam>',
            // ...
          },
          // ...
        }),
        // ...
      ],
      // ...
    };
    export default preview;
1.2.0

6 months ago

1.0.0-alpha.109

10 months ago

1.0.0-alpha.108

10 months ago

1.0.0-alpha.107

10 months ago

1.0.0-alpha.52

12 months ago

1.0.0-alpha.51

12 months ago

1.0.0-alpha.54

12 months ago

1.0.0-alpha.53

12 months ago

1.0.0-alpha.50

12 months ago

1.0.0-alpha.102

10 months ago

1.0.0-alpha.101

10 months ago

1.0.0-alpha.59

12 months ago

1.0.0-alpha.100

11 months ago

1.0.0-alpha.106

10 months ago

1.0.0-alpha.56

12 months ago

1.0.0-alpha.105

10 months ago

1.0.0-alpha.55

12 months ago

1.0.0-alpha.104

10 months ago

1.0.0-alpha.58

12 months ago

2.0.0

5 months ago

1.0.0-alpha.103

10 months ago

1.0.0-alpha.57

12 months ago

1.0.0-alpha.119

10 months ago

1.0.0-alpha.118

10 months ago

1.0.0-alpha.63

12 months ago

1.0.0-alpha.62

12 months ago

1.0.0-alpha.65

12 months ago

1.0.0-alpha.64

12 months ago

1.0.0-alpha.61

12 months ago

1.0.0-alpha.60

12 months ago

1.0.0-alpha.113

10 months ago

1.0.0-alpha.112

10 months ago

1.0.0-alpha.111

10 months ago

1.0.0-alpha.110

10 months ago

1.0.0-alpha.117

10 months ago

1.0.0-alpha.67

12 months ago

1.0.0-alpha.116

10 months ago

1.0.0-alpha.66

12 months ago

1.0.0-alpha.115

10 months ago

1.0.0-alpha.69

12 months ago

1.0.0-alpha.114

10 months ago

1.0.0-alpha.68

12 months ago

1.1.0

8 months ago

1.0.0-alpha.160

9 months ago

1.0.0-alpha.164

9 months ago

1.0.0-alpha.163

9 months ago

1.0.0-alpha.162

9 months ago

1.0.0-alpha.161

9 months ago

1.0.0-alpha.168

8 months ago

1.0.0-alpha.167

8 months ago

1.0.0-alpha.166

8 months ago

1.0.0-alpha.165

9 months ago

1.0.0-alpha.169

8 months ago

1.0.0-alpha.49

12 months ago

1.0.0-alpha.48

12 months ago

1.0.0-alpha.47

12 months ago

1.0.1

8 months ago

1.0.0

8 months ago

1.0.0-alpha.96

11 months ago

1.0.0-alpha.95

11 months ago

1.0.0-alpha.98

11 months ago

1.0.0-alpha.97

11 months ago

1.0.0-alpha.142

9 months ago

1.0.0-alpha.92

11 months ago

1.0.0-alpha.141

9 months ago

1.0.0-alpha.91

11 months ago

1.0.0-alpha.140

9 months ago

1.0.0-alpha.94

11 months ago

1.0.0-alpha.93

11 months ago

1.0.0-alpha.146

9 months ago

1.0.0-alpha.145

9 months ago

1.0.0-alpha.144

9 months ago

1.0.0-alpha.143

9 months ago

1.0.0-alpha.149

9 months ago

1.0.0-alpha.99

11 months ago

1.0.0-alpha.148

9 months ago

1.0.0-alpha.147

9 months ago

1.0.0-alpha.153

9 months ago

1.0.0-alpha.152

9 months ago

1.0.0-alpha.151

9 months ago

1.0.0-alpha.150

9 months ago

1.0.0-alpha.157

9 months ago

1.0.0-alpha.156

9 months ago

1.0.0-alpha.155

9 months ago

1.0.0-alpha.154

9 months ago

1.0.0-alpha.159

9 months ago

1.0.0-alpha.158

9 months ago

1.0.0-alpha.129

9 months ago

1.0.0-alpha.74

11 months ago

1.0.0-alpha.73

11 months ago

1.0.0-alpha.76

11 months ago

1.0.0-alpha.75

11 months ago

1.0.0-alpha.120

10 months ago

1.0.0-alpha.70

12 months ago

1.0.0-alpha.72

12 months ago

1.0.0-alpha.71

12 months ago

1.0.0-alpha.124

9 months ago

1.0.0-alpha.123

9 months ago

1.0.0-alpha.122

10 months ago

1.0.0-alpha.121

10 months ago

1.0.0-alpha.128

9 months ago

1.0.0-alpha.78

11 months ago

1.0.0-alpha.127

9 months ago

1.0.0-alpha.77

11 months ago

1.0.0-alpha.126

9 months ago

1.0.0-alpha.125

9 months ago

1.0.0-alpha.79

11 months ago

1.0.0-alpha.90

11 months ago

1.0.0-alpha.85

11 months ago

1.0.0-alpha.84

11 months ago

1.0.0-alpha.87

11 months ago

1.0.0-alpha.86

11 months ago

1.0.0-alpha.131

9 months ago

1.0.0-alpha.81

11 months ago

1.0.0-alpha.130

9 months ago

1.0.0-alpha.80

11 months ago

1.0.0-alpha.83

11 months ago

1.0.0-alpha.82

11 months ago

1.0.0-alpha.135

9 months ago

1.0.0-alpha.134

9 months ago

1.0.0-alpha.133

9 months ago

1.0.0-alpha.132

9 months ago

1.0.0-alpha.139

9 months ago

1.0.0-alpha.89

11 months ago

1.0.0-alpha.138

9 months ago

1.0.0-alpha.88

11 months ago

1.0.0-alpha.137

9 months ago

1.0.0-alpha.136

9 months ago

1.0.0-alpha.38

1 year ago

1.0.0-alpha.37

1 year ago

1.0.0-alpha.39

1 year ago

1.0.0-alpha.36

1 year ago

1.0.0-alpha.41

1 year ago

1.0.0-alpha.40

1 year ago

1.0.0-alpha.43

1 year ago

1.0.0-alpha.42

1 year ago

1.0.0-alpha.45

1 year ago

1.0.0-alpha.44

1 year ago

1.0.0-alpha.46

1 year ago

1.0.0-alpha.34

1 year ago

1.0.0-alpha.35

1 year ago

1.0.0-alpha.33

1 year ago

1.0.0-alpha.32

1 year ago

1.0.0-alpha.30

1 year ago

1.0.0-alpha.31

1 year ago

1.0.0-alpha.29

1 year ago

1.0.0-alpha.28

1 year ago

1.0.0-alpha.27

1 year ago

1.0.0-alpha.26

1 year ago

1.0.0-alpha.23

2 years ago

1.0.0-alpha.22

2 years ago

1.0.0-alpha.25

1 year ago

1.0.0-alpha.24

2 years ago

1.0.0-alpha.21

2 years ago

1.0.0-alpha.20

2 years ago

1.0.0-alpha.19

2 years ago

1.0.0-alpha.18

2 years ago

1.0.0-alpha.17

2 years ago

1.0.0-alpha.16

2 years ago

1.0.0-alpha.15

2 years ago

1.0.0-alpha.14

2 years ago

1.0.0-alpha.13

2 years ago

1.0.0-alpha.12

2 years ago

1.0.0-alpha.11

2 years ago

1.0.0-alpha.10

2 years ago

1.0.0-alpha.9

2 years ago

1.0.0-alpha.8

2 years ago

1.0.0-alpha.7

3 years ago

1.0.0-alpha.3

3 years ago