Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

gestalt-design-tokens

pinterest9.4kApache-2.0177.0.0TypeScript support: included

Design tokens style dictionary for Gestalt

design system, design tokens, gestalt, pinterest, ui library

readme

Gestalt · NPM Version License

Gestalt is Pinterest’s design system. Our system includes a React component library with comprehensive guidelines, best practices, tools, and resources to support designers and engineers delivering a high-quality product.

Visit the official Gestalt Documentation

Installation

The package can be installed via npm:

npm i gestalt --save
npm i gestalt-charts --save
npm i gestalt-datepicker --save

Or via yarn:

yarn add gestalt
yarn add gestalt-charts
yarn add gestalt-datepicker

Usage

Gestalt exports each component as ES6 modules and a single, precompiled CSS file:

import { Text } from 'gestalt';
import 'gestalt/dist/gestalt.css';
import 'gestalt/dist/gestalt-datepicker.css';

That syntax is Webpack specific (and will work with Create React App), but you can use Gestalt anywhere that supports ES6 module bundling and global CSS.

Development

Gestalt is a multi-project monorepo. The docs and components are all organized as separate packages that share similar tooling.

Install project dependencies and run tests:

yarn
yarn test

Build and watch Gestalt & run the docs server:

yarn start

Visit http://localhost:8888/ and click on a component to view the docs.

Codemods

When a release will cause breaking changes — in usage or in typing — we provide a codemod to ease the upgrade process. Codemods are organized by release in /packages/gestalt-codemods.

Codemod Usage

Clone the Gestalt repo locally if you haven't already. Run the relevant codemod(s) in the relevant directory of your repo (not the Gestalt repo): anywhere the component to be updated is used. Example usage for a codebase using TypeScript:

yarn codemod --parser=tsx -t={relative/path/to/codemod} relative/path/to/your/code.tsx

For a dry run to see what the changes will be, add the -d (dry run) and -p (print output) flags (pipe stdout to a file for easier inspection if you like).

Releasing

Every commit to master performs a release. As a reviewer, ensure the correct label is attached to every PR. Please follow semantic versioning.

  • patch release: documentation updates / spelling mistakes in code / internal scripts
  • minor release: add component / add component props / API change with codemod
  • major release: backwards incompatible API change without codemod

Example PR title: Avatar: Add outline prop

Typescript Support

Gestalt officiallty supports and maintains Typescript declarations files.

Issues

Gestalt is Pinterest's open-sourced design system. However, Gestalt's web component library is almost exclusively developed by a 5 engineer team within Pinterest, and our primary customers are Pinterest engineers who use Gestalt. The team’s priority is the needs of our internal Pinterest customers.

We do not have resources to work on features or issues requested only by external developers. We also handle a very large amount of internal support requests, so we do not have the resources to respond to external Github issues.

Pinterest is staying open source, as it's a great resource for the design and engineering community, but we don't provide support to external developers. If you need to get in touch, send us an email.

Troubleshooting

Take a look at our FAQ section if you run into any development problems.

changelog

This file is updated manually

145.2.0 https://github.com/pinterest/gestalt/pull/3441

MINOR

NEW

name light dark
color-background-mask-wash rgba(0, 0, 0, 0.04)
color-background-mask-default-base color.background.default.value
color-background-tabs-default-hover color.background.secondary.base.value
color-background-tabs-default-active #e2e2e2 #535353
color-background-tabs-transparent-base color.transparent.value
color-background-tabs-transparent-hover rgba(0, 0, 0, 0.06)
color-background-tabs-transparent-active rgba(0, 0, 0, 0.1)
color-border-pulsar-default #0074e8
color-border-pulsar-hover #dce9fa

Tokenize Mask, Mask, Pulsar background and border colors

145.1.0 https://github.com/pinterest/gestalt/pull/3441

MINOR

NEW

name light dark
color-background-avatar-wash rgba(0, 0, 0, 0.06) rgba(250, 250, 250, 0.5)
color-background-combobox-item-default color.transparent.value rgba(250, 250, 250, 0.5)
color-background-combobox-item-hover #efefef #404040
color-background-combobox-item-hover #efefef #404040
color-background-formfield-selected #111 #efefef
color-background-popover-primary color.background.default.value color.background.elevation.floating.darkValue
color-background-popover-secondary #111 #efefef
color-background-popover-education color.background.education.value
color-background-segmentedcontrol-tab-selected #fff #030303
color-background-switch-default-selected #111 #efefef
color-background-switch-default-unselected #fff #030303
color-background-switch-disabled-selected color.gray.roboflow.500.value #ababab
color-background-switch-disabled-unselected #efefef #404040
color-background-table-footer #fff #030303
color-background-table-row-hover #efefef #404040
color-background-table-row-selected #efefef #404040
color-background-video-container-primary color.background.inverse.base.value
color-background-video-container-secondary color.transparent.value
color-border-formfield-disabled #efefef #404040
color-border-popover-primary #fff #212121
color-border-popover-secondary #111 #efefef
color-border-popover-education color.background.education.value
color-border-table-row-selected color.black.cosmicore.900.value color.white.mochimalist.0.value
color-text-formfield-default #111 #efefef
color-text-formfield-disabled color.gray.roboflow.500.value #ababab
color-text-formfield-placeholder color.gray.roboflow.500.value #ababab
color-icon-avatar-default #111 #efefef

Why

Popover, SegmentedControl, Switch, Table background and border colors

Breaking change notes

--

144.0.0 https://github.com/pinterest/gestalt/pull/3439

MINOR

NEW

name light dark
color-background-avatar-placeholder #efefef #404040
color-border-avatar #fff #030303
color-border-formfield-error-default color.border.error.value #212121
color-border-formfield-error-hover #ad081b #cf001f
color-border-tag-disabled #767676 #ababab

Why

Tokenize Avatar, Tag, and formfield background and border colors

Breaking change notes

--

143.1.0 https://github.com/pinterest/gestalt/pull/3438

MINOR

NEW

name light dark
color-background-datepicker-container #fff #212121
color-background-datepicker-button-default #fff #212121
color-background-datepicker-button-hover rgba(0, 0, 0, 0.06) rgba(250, 250, 250, 0.5)
color-background-datepicker-button-selected #111 #efefef
elevation-datepicker 0 0 8px rgba(0, 0, 0, 0.1) 0 0 8px rgba(250, 250, 250, 0.6)
rounding-datepicker-side-end rounding-circle rounding-0 rounding-0 rounding-circle NA
rounding-datepicker-side-start rounding-0 rounding-circle rounding-circle rounding-0 NA

Why

Tokenize DatePicker component colors, elevation & rounding

Breaking change notes

--

143.0.0 https://github.com/pinterest/gestalt/pull/3434

MINOR

NEW

name light dark
color-background-formfield-primary #fff #030303
color-background-formfield-disabled #efefef #404040

Why

Tokenize FormField component background colors

Breaking change notes

--

142.4.0 https://github.com/pinterest/gestalt/pull/3432

MINOR

NEW

name light dark
color-background-tableofcontents-item-default color.transparent.value
color-background-tableofcontents-item-hover color.background.secondary.base.value
color-background-tiledata-01 {color.data-visualization.01.value}1A {color.data-visualization.01.darkValue}1A
color-background-tiledata-02 {color.data-visualization.02.value}1A {color.data-visualization.02.darkValue}1A
color-background-tiledata-03 {color.data-visualization.03.value}1A {color.data-visualization.03.darkValue}1A
color-background-tiledata-04 {color.data-visualization.04.value}1A {color.data-visualization.04.darkValue}1A
color-background-tiledata-05 {color.data-visualization.05.value}1A {color.data-visualization.05.darkValue}1A
color-background-tiledata-06 {color.data-visualization.06.value}1A {color.data-visualization.06.darkValue}1A
color-background-tiledata-07 {color.data-visualization.07.value}1A {color.data-visualization.07.darkValue}1A
color-background-tiledata-08 {color.data-visualization.08.value}1A {color.data-visualization.08.darkValue}1A
color-background-tiledata-09 {color.data-visualization.09.value}1A {color.data-visualization.09.darkValue}1A
color-background-tiledata-10 {color.data-visualization.10.value}1A {color.data-visualization.10.darkValue}1A
color-background-tiledata-11 {color.data-visualization.11.value}1A {color.data-visualization.11.darkValue}1A
color-background-tiledata-12 {color.data-visualization.12.value}1A {color.data-visualization.12.darkValue}1A
color-background-tiledata-hover color.background.secondary.base.value
color-background-tiledata-disabled #efefef #404040

Why

Tokenize TableOfContents, TileData component background colors

Breaking change notes

--

142.3.0 https://github.com/pinterest/gestalt/pull/3427

MINOR

NEW

name light dark
color-background-badge-neutral color.background.tertiary.base.value
color-background-badge-info-default color.background.info.base.value
color-background-badge-info-hover color.background.info.strong.value
color-background-badge-error color.background.error.base.value
color-background-badge-warning color.background.warning.base.value
color-background-badge-success color.background.success.base.value
color-background-badge-recommendation color.background.recommendation.base.value
color-background-badge-lightwash color.background.wash.light.value
color-background-badge-darkwash color.background.wash.dark.value
color-background-tagdata-primary color.background.secondary.base.value
color-background-tagdata-secondary color.background.default.value
color-background-tagdata-disabled #efefef #404040

Why

Tokenize Badge / TagData component background colors

Breaking change notes

--

142.2.0 https://github.com/pinterest/gestalt/pull/3422

PATCH

RENAME

old-name new-name
color-background-box-transparent-dark-gray color-background-box-transparentdarkgray
color-background-box-light-wash color-background-box-lightwash
color-background-box-dark-wash color-background-box-darkwash

142.2.0 https://github.com/pinterest/gestalt/pull/3422

MINOR

NEW

name light dark
color-background-box-default color.background.default.value
color-background-box-info-base color.background.info.base.value
color-background-box-info-weak color.background.info.weak.value
color-background-box-error-base color.background.error.base.value
color-background-box-error-weak color.background.error.weak.value
color-background-box-warning-base color.background.warning.base.value
color-background-box-warning-weak color.background.warning.weak.value
color-background-box-success-base color.background.success.base.value
color-background-box-success-weak color.background.success.weak.value
color-background-box-recommendation-base color.background.recommendation.base.value
color-background-box-recommendation-weak color.background.recommendation.weak.value
color-background-box-shopping color.background.shopping.value
color-background-box-primary color.background.primary.base.value
color-background-box-secondary color.background.secondary.base.value
color-background-box-tertiary color.background.tertiary.base.value
color-background-box-selected color.background.selected.base.value
color-background-box-inverse color.background.inverse.base.value
color-background-box-brand color.background.brand.value
color-background-box-education color.background.education.value
color-background-box-elevation-accent color.background.elevation.accent.value
color-background-box-elevation-floating color.background.elevation.floating.value
color-background-box-elevation-raised color.background.elevation.raised.value
color-background-box-dark color.background.dark.value
color-background-box-light color.background.light.value
color-background-box-light-wash #e2e2e2 #535353
color-background-box-dark-wash #dadada #666
color-background-box-transparent color.transparent.value
color-background-box-transparent-dark-gray rgba(51, 51, 51, 0.8) rgba(255, 255, 255, 0.8)

Why

Tokenize Box component background colors

Breaking change notes

--

142.1.0 https://github.com/pinterest/gestalt/pull/3422

MINOR

NEW

name light dark
color-background-tag-primary-default color.background.secondary.base.value
color-background-tag-primary-hover #e2e2e2 #535353
color-background-tag-primary-active #dadada #666
color-background-tag-error-default color.background.error.base.value
color-background-tag-error-hover #ad081b #cf001f
color-background-tag-error-active #a3081a #b8001b
color-background-tag-warning-default color.background.warning.base.value
color-background-tag-warning-hover color.yellow.caramellow.600.value
color-background-tag-warning-active color.yellow.caramellow.700.value

Why

Tokenize Tag component background colors

Breaking change notes

--

142.0.0 https://github.com/pinterest/gestalt/pull/3423

MAJOR

RENAME

old-name new-name
color-background-overlay-color-background color-background-overlay

Why

Bug introduced in https://github.com/pinterest/gestalt/pull/3421

Breaking change notes

--

141.0.0 https://github.com/pinterest/gestalt/pull/3421

MAJOR

RENAME

old-name new-name
button-background-color-primary-active color-background-button-primary-active
button-background-color-secondary-default color-background-button-secondary-default
button-background-color-secondary-hover color-background-button-secondary-hover
button-background-color-secondary-active color-background-button-secondary-active
button-background-color-tertiary-hover color-background-button-tertiary-hover
button-background-color-tertiary-active color-background-button-tertiary-active
button-background-color-shopping-active color-background-button-shopping-active
button-background-color-white-default color-background-button-white-default
button-background-color-white-hover color-background-button-white-hover
button-background-color-white-active color-background-button-white-active
button-background-color-gray-hover color-background-button-gray-hover
button-background-color-gray-active color-background-button-gray-active
button-background-color-semitransparentwhite-default color-background-button-semitransparentwhite-default
button-background-color-semitransparentwhite-hover color-background-button-semitransparentwhite-hover
button-background-color-semitransparentwhite-active color-background-button-semitransparentwhite-active
button-background-color-semitransparentdark-default color-background-button-semitransparentdark-default
button-background-color-semitransparentdark-hover color-background-button-semitransparentdark-hover
button-background-color-semitransparentdark-active color-background-button-semitransparentdark-active
button-background-color-disabled-default color-background-button-disabled-default
overlay-color-background color-background-overlay-color-background

Why

Component tokens now follow the token structure defined in style-dictionary: Category / Type / Item

Breaking change notes

Component token name stucture chamhes from component-category-property-variant to category-type-item-subitem-state

This PR introduces a bug in color-background-overlay-color-background fixed in #3423

140.0.1 https://github.com/pinterest/gestalt/pull/3420

Minor

name old value new value
rounding-0 0 0px
space-0 0 0px

Why

0 values break in Android and rounding was not added in the config.

Breaking change notes

--

139.1.0 https://github.com/pinterest/gestalt/pull/3413

Minor

NEW

name light dark
overlay-color-background color.background.default.value color.background.elevation.floating.darkValue

REVERT

name old value new value
color-background-wash-dark rgb(0 0 0 / 0.8) rgba(0, 0, 0, 0.8)
color-background-wash-light rgb(255 255 255 / 0.9) rgba(255, 255, 255, 0.9)

Why

Tokenize overlay component background colors. Overlay components require a white background but a floating elevation on darkmode. We needed a custom color pairing.

Breaking change notes

Partially reverting token changes in from https://github.com/pinterest/gestalt/pull/3407

--

139.0.0 https://github.com/pinterest/gestalt/pull/3410

NEW

name light dark
button-color-gray-default color.background.neutral.value
button-color-gray-hover #878787
button-color-gray-active #828282 #9b9b9b
button-color-semitransparentdark-default rgba(51, 51, 51, 0.8) rgba(255, 255, 255, 0.8)
button-color-semitransparentdark-hover #121212 #f0f0f0
button-color-semitransparentdark-active #1f1f1f #e0e0e0

Why

Tokenize Pog colors.

Breaking change notes

--

136.0.1 https://github.com/pinterest/gestalt/pull/3407

This PR introduces a BUG!

Patch

name old value new value
color-background-wash-dark rgba(0, 0, 0, 0.8) rgb(0 0 0 / 0.8)
color-background-wash-light rgba(255, 255, 255, 0.9) rgb(255 255 255 / 0.9)
button-color-tertiary-hover rgba(0, 0, 0, 0.06) / rgba(250, 250, 250, 0.5) rgb(0 0 0 / 0.06) / rgb(250 250 250 / 0.5)
button-color-tertiary-active rgba(0, 0, 0, 0.1) / rgba(250, 250, 250, 0.6) rgb(0 0 0 / 0.1) / rgb(250 250 250 / 0.6)
button-color-semitransparentwhite-default rgba(255, 255, 255, 0.8) / rgba(51, 51, 51, 0.8) rgb(255 255 255 / 0.8) / rgb(51 51 51 / 0.8)
elevation-floating 0 0 8px rgba(0, 0, 0, 0.10) 0 0 8px rgb(0 0 0 / 0.10)
elevation-raised-top 0 2px 8px rgba(0, 0, 0, 0.12) 0 2px 8px rgb(0 0 0 / 0.12)
elevation-raised-bottom 0 -2px 8px rgba(0, 0, 0, 0.12) 0 -2px 8px rgb(0 0 0 / 0.12)

Why

Modern color-functions use a comma-free syntax because functions in CSS are used to group/name a syntax chunk.

Breaking change notes

This PR introduces a bug as reported by Android where alpha values color_background_wash_dark and color_background_wash_light and now that alpha value is gone, leaving the color just black and white without opacity value assigned.

136.0.0 https://github.com/pinterest/gestalt/pull/3404

Major

old name new name value
color-text-icon-default color-icon-default
color-text-icon-subtle color-icon-subtle
color-text-icon-info color-icon-info
color-text-icon-recommendation color-icon-recommendation
color-text-icon-success color-icon-success
color-text-icon-warning color-icon-warning
color-text-icon-error color-icon-error
color-text-icon-inverse color-icon-inverse

Why

Both text and icon are content and should be at the same token level

Breaking change notes

Token instances must manually change tokens from color-text-icon-_ to color-icon-_

134.3.0 https://github.com/pinterest/gestalt/pull/3401

Minor

NEW

name light dark
button-color-primary-default color.background.primary.base
button-color-primary-hover color.background.primary.strong.value
button-color-primary-active "#a3081a #b8001b
button-color-secondary-default color.background.secondary.base color.gray.roboflow.600.value
button-color-secondary-hover #e2e2e2 #535353
button-color-secondary-active #dadada #666
button-color-tertiary-default color.transparent.value
button-color-tertiary-hover rgb(0 0 0 / 0.06) rgb(250 250 250 / 0.5)
button-color-tertiary-active rgb(0 0 0 / 0.1) rgb(250 250 250 / 0.6)
button-color-shopping-default color.background.shopping.value
button-color-shopping-hover #4a8ad4
button-color-shopping-active 4a85c9 #4a85c9
button-color-white-default color.white.mochimalist.0.value #030303
button-color-white-hover #f0f0f0 #121212
button-color-white-active #e0e0e0 #1f1f1f
button-color-semitransparentwhite-default rgb(255 255 255 / 0.8) rgb(51 51 51 / 0.8)
button-color-semitransparentwhite-hover #f0f0f0 #121212
button-color-semitransparentwhite-active #e0e0e0 #1f1f1f
button-color-disabled-default color.background.secondary.base color.gray.roboflow.600
button-color-selected-default color.background.selected.base

Why

Tokenize current Button color styles

Breaking change notes

--

134.0.0 https://github.com/pinterest/gestalt/pull/3394

Major

name old value new value
color-text-subtle color.gray.roboflow.550.value color.gray.roboflow.500.value
color-text-icon-subtle color.gray.roboflow.550.value color.gray.roboflow.500.value

Before Screenshot by Dropbox Capture

After Screenshot by Dropbox Capture

Why

Reconcile with Figma values

Breaking change notes

It might break visual snapshots