6.13.6 • Published 3 days ago

@ni/nimble-tokens v6.13.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 days ago

Nimble Tokens

NPM Version Nuget Version

NI base design tokens. Design tokens are primitive elements of component style like color, typography, and spacing. These should generally not be consumed directly by applications. See below for guidance.

Getting Started

If you are using one of the following frameworks you should consume tokens via components implemented in the following libraries. These libraries provide styled components that use the design tokens to implement several color themes.

  1. Angular: See the nimble-angular documentation.
  2. Blazor WebAssembly or Blazor Server: See the nimble-blazor documentation.
  3. Vanilla / Frameworkless: See the nimble-components documentation.

Using Theme-Aware Tokens

The above libraries also offer a theming system which is independent of other components from the library. Adopting this theming system can be a cheaper way to update a legacy application to approximate the NI brand without the development and testing burden of adopting a new component library.

Applications should typically use this theming system rather than depending on nimble-tokens directly. See the theming documentation in nimble-components for more information.

Using Nimble Base Tokens Directly

In limited special cases, you may consume base Nimble tokens directly. This is only recommended in cases where the theme-aware tokens don't work (for example desktop applications or legacy browsers that don't support custom elements) as these tokens are unaware of themes and don't contain guidance mapping them to specific component parts.

To add the Nimble tokens package to your application, install it from the public NPM registry by running npm install @ni/nimble-tokens.

Understanding Base Color Tokens

You can view the available color tokens here. To understand their meaning, explore other pages of the document in Specs Mode (click the </> icon on the right side) and view how color tokens are applied to Nimble components.

Using Base Tokens

The tokens are available in several formats:

CSS and SCSS variables

Tokens like colors, font families, and spacing are available as CSS and SCSS variables.

  1. Assuming your application uses the Webpack css-loader, in your application CSS, add @import url('@ni/nimble-tokens/dist/styledictionary/css/variables.css'); (replacing css with scss as needed).
  2. Use the variables from that file to style your UI:
body { background-color: var(--ni-nimble-base-white); }

JavaScript and TypeScript

Tokens like colors, font families, and spacing are also available as JavaScript and TypeScript string constants.

  • colors are represented as hex RGB strings like: #ff8126
  • font families and fallbacks are represented as comma separated strings like: Roboto, Microsoft YaHei, Hiragino Kaku Gothic Pro, sans-serif
  • spacing is represented in CSS units like: 12px

In your application JavaScript or TypeScript code, import the token strings you want to use:

import { White } from '@ni/nimble-tokens/dist/styledictionary/js/tokens';

Other formats

Tokens values are also available as:

Icons

Icons are included in the nimble-tokens package, but (like tokens) icons should primarily consumed through framework-specific components. If your desktop application requires icons as .ico files, ask a Nimble team member for a copy of the NimbleTokens.x.x.xx.nupkg file.

Font Faces

Nimble provides font definitions for every font family used by a token. To ensure these fonts are available to your application, include @ni/nimble-tokens/dist/fonts/css/fonts.css in your application code.

Contributing

Follow the instructions in CONTRIBUTING.md to modify this library.

6.13.6

3 days ago

6.13.5

16 days ago

6.13.4

16 days ago

6.13.3

16 days ago

6.13.2

27 days ago

6.13.1

2 months ago

6.13.0

2 months ago

6.12.1

2 months ago

6.12.0

2 months ago

6.11.1

3 months ago

6.11.0

3 months ago

6.10.1

3 months ago

6.10.0

3 months ago

6.9.1

4 months ago

6.9.0

5 months ago

6.3.0

9 months ago

6.5.0

7 months ago

6.6.0

7 months ago

6.8.0

6 months ago

6.2.1

10 months ago

6.2.0

10 months ago

6.4.1

7 months ago

6.4.0

8 months ago

6.7.0

6 months ago

6.1.0

11 months ago

6.0.0

1 year ago

4.9.0

1 year ago

4.7.2

1 year ago

4.7.1

1 year ago

4.7.3

1 year ago

5.0.0

1 year ago

4.8.0

1 year ago

4.4.0

1 year ago

4.6.0

1 year ago

4.5.0

1 year ago

4.7.0

1 year ago

4.3.2

1 year ago

4.3.1

1 year ago

4.2.0

2 years ago

4.3.0

2 years ago

4.1.3

2 years ago

4.1.2

2 years ago

4.1.1

2 years ago

4.1.0

2 years ago

4.0.1

2 years ago

3.2.2

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.2.4

2 years ago

3.2.3

2 years ago

4.0.0

2 years ago

3.0.12

2 years ago

3.0.13

2 years ago

3.0.10

2 years ago

3.0.11

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.9

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

1.0.0-beta.22

3 years ago

1.0.0-beta.28

2 years ago

1.0.0-beta.29

2 years ago

1.0.0-beta.27

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.0.0-beta.33

2 years ago

1.0.0-beta.34

2 years ago

1.0.0-beta.31

2 years ago

1.0.0-beta.32

2 years ago

1.0.0-beta.30

2 years ago

1.0.0-beta.39

2 years ago

1.0.0-beta.37

2 years ago

1.0.0-beta.38

2 years ago

1.0.0-beta.35

2 years ago

1.0.0-beta.36

2 years ago

1.0.0-beta.20

3 years ago

1.0.0-beta.21

3 years ago

1.0.0-beta.19

3 years ago

1.0.0-beta.18

3 years ago

1.0.0-beta.17

3 years ago

1.0.0-beta.15

3 years ago

1.0.0-beta.16

3 years ago

1.0.0-beta.14

3 years ago

1.0.0-beta.12

3 years ago

1.0.0-beta.13

3 years ago

1.0.0-beta.11

3 years ago

1.0.0-beta.10

3 years ago

1.0.0-beta.5

3 years ago

1.0.0-beta.6

3 years ago

1.0.0-beta.7

3 years ago

1.0.0-beta.8

3 years ago

1.0.0-beta.9

3 years ago

1.0.0-beta.4

3 years ago

1.0.0-beta.3

3 years ago

1.0.0-beta.2

3 years ago

1.0.0-beta.1

3 years ago

1.0.0-beta.0

3 years ago

1.0.0-alpha.5

3 years ago

1.0.0-alpha.4

3 years ago

1.0.0-alpha.3

3 years ago

1.0.0-alpha.2

3 years ago

1.0.0-alpha.1

3 years ago

1.0.0-alpha.0

3 years ago