npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mijnoverheid/design-tokens

v1.0.0-alpha.5

Published

MijnOverheid design tokens

Downloads

4

Readme

Design Tokens for the MijnOverheid Design System

This project is very much WORK IN PROGRESS and is released as alpha version. Always define the exact version you want to use, and test for breaking changes before upgrading to a newer alpha release.

Design tokens are design decisions for our design system, in this case maintained in JSON files, and distributed in various other code languages for easy reuse.

The design tokens in this package serve as single source of truth for the look and feel for our websites, apps and designs of new products and services.

List of all design tokens

To find out what design tokens are available, browser through the .style-dictionary.json files in the src/ directory.

We currently don't have any additional documentation for every specific design token.

Brand design tokens

Brand design tokens describe design choices regarding color and typography. We provide a limited choice of fonts and a limited color palette, please avoid choosing other fonts and colors.

Common design tokens

Common design tokens are relevant to a wide range of components and situations. They help provide a consistent user experience. We provide design tokens for feedback colors (error, success, et cetera), the focus state, spacing, and so on. Components should reuse design tokens from the common layer where possible, to achieve a consistent look and feel.

Component design tokens

Design decisions at a component level, to make components look a very specific way. They are applied by the component library of the design system.

Files in this package

dist/theme/index.css

Opt-in way to apply all the CSS variables to HTML elements with the mijnoverheid-theme class name:

<!DOCTYPE html>
<html class="mijnoverheid-theme">
  <!-- var(--mijnoverheid-typography-sans-serif-font-family) works here...! -->
</html>

This method is the preferred way to style the page.

dist/index.css

Automatically applies all the CSS variables to HTML elements to the :root element:

<!DOCTYPE html>
<html>
  <!-- var(--mijnoverheid-typography-sans-serif-font-family) works here...! -->
</html>

This method should only be used in case there is no control over the HTML template and the mijnoverheid-theme class name cannot be included.

dist/properties.css

Experimental CSS @property definitions for the design tokens that are configurable via CSS custom properties. Including these definitions is not necessarily side-effect free: with syntax invalid values for custom properties will be ignored, and inherits and initial-value declarations can influence behavior. Because not all browsers support the @property declaration, including this file can result in rendering differences between browsers.

<link rel="stylesheet" href="https://unpkg.com/@mijnoverheid/design-tokens/dist/properties.css" />

This file should only be included when you have visual regression test for both browsers that do and don't support @property.

dist/index.js

Use files from this package in JavaScript projects, for example in React Native or Storybook:

import { MijnoverheidButtonFontSize } from "@mijnoverheid/design-tokens/dist/index.js";

dist/_variables.scss

@import "~@mijnoverheid/design-tokens/dist/variables";

button {
  font-size: $mijnoverheid-button-font-size;
}

SCSS variables are not the preferred way to style components, it is better to use CSS variables, because they can be configured differently in a specific context, whereas SCSS variables are given a fixed value at build-time.

However, SCSS variables could be very useful to re-use values where CSS variables cannot be used, like inside CSS media queries:

@import "~@mijnoverheid/design-tokens/dist/variables";

@media (min-width: $mijnoverheid-viewport-scale-xl-width) {
  --mijnoverheid-heading-1-font-size: 3rem;
}

SCSS variables are also useful in the process of incrementally migrating away from your a codebase that currently uses SCSS, such as a website built with Bootstrap 4 components, by already using the design tokens as single source of truth. For example:

@import "../node_modules/bootstrap/scss/bootstrap";

$body-bg: $mijnoverheid-document-background-color;
$body-color: $mijnoverheid-document-color;

CSS variables

To use the design tokens in your site via CSS variables, first include the design token definitions in the <head> section of your HTML page:

<link rel="stylesheet" href="https://unpkg.com/@mijnoverheid/design-tokens/dist/index.css" />

Now the CSS variables will be available and you can use of all the design tokens:

.my-button {
  background-color: var(--mijnoverheid-color-red-50);
  color: var(--mijnoverheid-color-white);
}

SCSS variables

Contributing

The design tokens are stored in JSON files so we can use the design token translation tool Style Dictionary to make them available in many code languages. We use .style-dictionary.json as file extension for our design token definitions, to tell them apart from regular and unrelated .json files.

Style Dictionary only recognizes one nesting level per file, so be careful to not to mix nesting levels in one file and separate them into multiple files.

The following example doesn't work, because the CSS output would only be --mijnoverheid-button-focus-background-color: navy.

{
  "mijnoverheid": {
    "button": {
      "background-color": "blue",
      "focus": {
        "background-color": "navy"
      }
    }
  }
}

Organize the design tokens in multiple files instead:

block.style-dictionary.json:

{
  "mijnoverheid": {
    "button": {
      "background-color": "blue",
      "focus": {
        "background-color": "navy"
      }
    }
  }
}

modifier.style-dictionary.json:

{
  "mijnoverheid": {
    "button": {
      "background-color": "blue",
      "focus": {
        "background-color": "navy"
      }
    }
  }
}

CSS property definitions

Design tokens in Style Dictionary JSON files can include CSS custom property definitions. Using a custom formatter we output a CSS file with corresponding @property declarations.

{
  "mijnoverheid-color": {
    "css": { "syntax": "<color>", "inherits": true }
  },
  "mijnoverheid-font-family": {
    "css": { "syntax": "*", "inherits": true }
  },
  "mijnoverheid-text-align": {
    "css": { "syntax": "start | end", "inherits": true }
  }
}

syntax: any supported name, a list of tokens and * are allowed. Required.

inherits: typically set to true. While "inherits": false is supported, it is discouraged because not all target browsers support this yet. Required.

initialValue: also supported, but currently discouraged because not all browsers support @property yet and it would result in significant rendering differences between supporting and non-supporting target browsers.

License

Copyright © 2021 Logius. All rights reserved.

The open source license does NOT apply to files in this directory.

Applying design elements from this project is strictly prohibited for organisations that are not part of the central Government of The Netherlands.

This project is part of a community iniative to use NL Design System components for projects that need to adhere to Rijkshuisstijl. Organisations from the central Government of the Netherlands (for example: Belastingdienst, DUO, Logius, SVB), as well as those who are contracted by them to develop websites and apps, are able to collaborate via this project.