9.1.0 • Published 18 hours ago

@shopify/polaris-tokens v9.1.0

Weekly downloads
81,664
License
SEE LICENSE IN LI...
Repository
github
Last release
18 hours ago

CircleCI npm version code style: prettier


Design tokens for Polaris, Shopify’s design system.

Design tokens originated at Salesforce, and the best way to describe them is to simply quote their documentation:

Design tokens are the visual design atoms of the design system — specifically, they are named entities that store visual design attributes. We use them in place of hard-coded values (such as hex values for color or pixel values for spacing) in order to maintain a scalable and consistent visual system for UI development – Salesforce UX

Installation

Polaris design tokens are available on npm as the @shopify/polaris-tokens package.

The recommended way to use and install design tokens may vary depending on your project, the most common are documented below.

Using npm:

npm install @shopify/polaris-tokens --save

Using yarn:

yarn add @shopify/polaris-tokens

Usage

Find all available tokens in the design tokens documentation.

JavaScript

In JavaScript, design token names are formatted in lower camelCase.

const tokens = require('@shopify/polaris-tokens');
console.log(tokens.colorBlueLighter); // rgb(235, 245, 250)

In JSON, design token names are formatted in kebab-case.

const tokens = require('@shopify/polaris-tokens/dist/index.json');
console.log(tokens['color-blue-lighter']); // rgb(235, 245, 250)

Sass

Sass variables and map keys are formatted in kebab-case.

// Using variables
@import '~@shopify/polaris-tokens/dist/index';

a {
  color: $color-blue-text;
}

// Using the map of all tokens
@import '~@shopify/polaris-tokens/dist/index.map';

a {
  color: map-get($polaris-index-map, 'color-blue-text');
}

// Using the map for a specific type of tokens (here: spacing)
@import '~@shopify/polaris-tokens/dist/spacing.map';

a {
  color: map-get($polaris-spacing-map, 'spacing-loose');
}

Sass, with CSS Custom Properties

Custom properties are formatted in kebab-case.

// Omit .css at the end of the file
@import '~@shopify/polaris-tokens/dist/colors.custom-properties';

a {
  color: var(--color-blue-text);
}

Contributing

The purpose of this repository is to see the core design elements of the Polaris design system evolve and improve over time with the needs of developers, designers and partners in mind.

We gratefully accept impromptu contributions to the documentation, typo and bug fixes, and expect design token requests and changes to be discussed before a pull request.

Code of conduct

We have a code of conduct, please follow it in all your interactions with the project.

Contributing guide

Read the contributing guide to learn how to propose changes and understand our development process.

License

The polaris-tokens project is available under the MIT license.

9.1.0

1 day ago

9.0.1

13 days ago

9.0.0

29 days ago

8.10.0

1 month ago

8.9.0

1 month ago

8.7.0

3 months ago

8.8.0

3 months ago

8.6.0

3 months ago

8.5.0

4 months ago

8.4.0

5 months ago

8.3.0

5 months ago

8.2.0

5 months ago

7.11.0

8 months ago

7.10.0

8 months ago

7.8.0

8 months ago

8.0.0-beta.1

7 months ago

7.9.0

8 months ago

7.12.0

8 months ago

7.12.1

7 months ago

8.1.0

6 months ago

7.4.0

10 months ago

7.5.3

9 months ago

7.5.2

10 months ago

7.5.1

10 months ago

7.5.0

10 months ago

7.13.0-beta.0

7 months ago

7.6.0

8 months ago

7.7.0

8 months ago

8.0.1

7 months ago

8.0.0

7 months ago

8.0.2

6 months ago

7.3.1

11 months ago

7.3.0

11 months ago

6.14.0

12 months ago

7.0.0

12 months ago

7.1.0

11 months ago

7.2.0

11 months ago

6.7.0

1 year ago

6.8.1

1 year ago

6.8.0

1 year ago

6.9.0

1 year ago

6.13.0

1 year ago

6.12.0

1 year ago

6.11.0

1 year ago

6.10.0

1 year ago

6.5.0

1 year ago

6.6.1

1 year ago

6.6.0

1 year ago

6.4.0

1 year ago

6.5.1

1 year ago

6.2.1

2 years ago

6.2.0

2 years ago

6.3.0

2 years ago

6.1.0

2 years ago

6.0.1

2 years ago

5.3.0

2 years ago

5.4.0

2 years ago

5.5.2

2 years ago

5.5.1

2 years ago

5.5.0

2 years ago

6.0.0

2 years ago

5.1.0-next.1

2 years ago

5.0.1

2 years ago

5.0.2-next.0

2 years ago

5.1.1

2 years ago

5.1.0

2 years ago

5.2.1

2 years ago

5.2.0

2 years ago

5.0.0-rc.1

2 years ago

5.0.0-rc.2

2 years ago

5.0.0-rc.3

2 years ago

5.0.0-rc.4

2 years ago

5.0.0-rc.5

2 years ago

5.0.0-rc.6

2 years ago

5.0.0

2 years ago

4.0.0

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.21.1

3 years ago

2.21.0

3 years ago

2.20.0

3 years ago

2.19.0

3 years ago

2.18.0

3 years ago

2.17.0

3 years ago

2.16.0

3 years ago

2.15.0

4 years ago

2.14.0

4 years ago

2.13.1

4 years ago

2.13.0

4 years ago

2.12.9

4 years ago

2.12.8

4 years ago

2.12.7

4 years ago

2.12.6

4 years ago

2.12.5

4 years ago

2.12.4

4 years ago

2.12.3

4 years ago

2.12.2

4 years ago

2.12.1

4 years ago

2.12.0

4 years ago

2.11.0

4 years ago

2.10.0

4 years ago

2.9.0

4 years ago

2.8.2

4 years ago

2.8.1

4 years ago

2.8.0-rc.0

4 years ago

2.8.0

4 years ago

3.0.0-beta.7

4 years ago

3.0.0-beta.6

4 years ago

3.0.0-beta.5

4 years ago

3.0.0-beta.4

4 years ago

3.0.0-beta.3

4 years ago

3.0.0-beta.2

4 years ago

3.0.0-beta.1

4 years ago

2.7.0

5 years ago

2.6.0

5 years ago

2.5.0

5 years ago

2.4.0

5 years ago

2.4.0-beta.2

5 years ago

2.4.0-beta.1

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.1.0-beta.7

6 years ago

1.1.0-beta.6

6 years ago

1.1.0-beta.4

6 years ago

1.1.0-beta.2

6 years ago

1.1.0-beta.1

6 years ago

1.0.0

6 years ago

0.19.3

6 years ago

0.16.0

6 years ago

0.15.1

6 years ago

0.15.0

6 years ago

0.14.6

6 years ago

0.14.5

6 years ago

0.14.3

6 years ago