Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@entur/tokens

Package Overview
Dependencies
Maintainers
13
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@entur/tokens

This package contains all design tokens used throughout the design system. You'l find all of them in the `src/tokens.ts` file.

  • 3.4.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.5K
increased by14.93%
Maintainers
13
Weekly downloads
 
Created
Source

Entur design tokens

This package contains all design tokens used throughout the design system. You'l find all of them in the src/tokens.ts file.

💡 Looking for the documentation?

Installation

npm install @entur/tokens
# or if you are using Yarn:
yarn add @entur/tokens

Usage

Please refer to the documentation for in-depth usage information.

This package has several main exports:

  • a CSS file with all tokens as kebab-cased CSS properties
  • a SCSS file with all tokens as kebab-cased SCSS variables
  • a LESS file with all tokens as kebab-cased LESS variables
  • a JavaScript file with all tokens as nested objects.

CSS

To use the CSS file, import it into your bundle like so:

import '@entur/tokens/dist/styles.css';

You'll then have access to all design tokens as CSS variables. You can then use them like so:

.custom-box {
  background-color: var(--colors-greys-grey10);
  color: var(--colors-brand-coral);
  font-size: var(--font-sizes-medium);
  margin: var(--space-medium) var(--space-large);
}

Please refer to the design system documentation for which ones are available.

LESS / SCSS

To use the LESS or SCSS files, import it into your LESS or SCSS file. The method is the same:

@import '~@entur/tokens/dist/styles.less';
@import '~@entur/tokens/dist/styles.scss';

You'll then be able to use the variables in your code as usual.

// LESS
.custom-box {
  background-color: @colors-greys-grey10;
  color: @colors-brand-coral;
  font-size: @font-sizes-medium;
  margin: @space-medium @space-large;
}
// SCSS
.custom-box {
  background-color: $colors-greys-grey10;
  color: $colors-brand-coral;
  font-size: $font-sizes-medium;
  margin: $space-medium $space-large;
}

JavaScript

To use the design tokens in JavaScript, import the ones you need like so:

import { StyleSheet } from 'react-native';
import { colors, breakpoints, fontSizes } from '@entur/tokens';

StyleSheet.create({
  example: {
    fontSize: fontSizes.medium,
    color: colors.brand.coral,
  },
});
px vs rem

These values are mainly provided in pixels. If you need the values in rem instead, add a .rem after the token name, e.g. space.rem.large for rem value and space.large for pixel value.

FAQs

Package last updated on 02 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc