Design tokens are special variables used to maintain a scalable visual system for UI development and brand consistency. Cedar design tokens store the visual design attributes that define the foundation of REI’s visual language, including color, typography, and spacing.
Visit the All Tokens page for a complete list of available design tokens.
Design tokens are key-value pairs. For example:
Key: value;
cdr-color-text-primary: rgba(12, 11, 8, 0.75);
Design Tokens can streamline redesign processes when:
Design Tokens can be used by teams:
Questions about when to use design tokens? Ask the Cedar team in #cedar-user-support (opens new window)
Token libraries are automatically available in the Assets panel when you create a new file in Figma. These libraries contain color, type, spacing, prominence, and icon styles that correspond to Cedar tokens.
When using design tokens, it’s your responsibility to pass the entire design token name to the developer during the design hand-off process—this can be through automated or manual methods.
For more information, see Getting Started As A Designer.
A base requirement for using Cedar design tokens is that you are able to consume and maintain packages through the following development processes:
Resources are available within the CdrToken package (opens new window):
npm install --save-dev @rei/cdr-tokens
dist/scss/cdr-tokens.scss
dist/less/cdr-tokens.less
dist/js
. Also noted in package.json as main
and module
respectively
dist/js/cdr-tokens.common.js
dist/js/cdr-tokens.esm.js
SCSS example:
@import '@rei/cdr-tokens/dist/scss/cdr-tokens.scss'; /* import the design tokens file */
.your-default-text-class {
/* use mixins to apply many properties at once */
@include cdr-text-default;
}
.your-other-default-text-class {
/* using SCSS placeholder selectors instead of mixins can optimize your final CSS output */
@extend %cdr-text-default;
}
.your-other-text-class {
/* use scss variables if you need to apply specific properties */
color: $cdr-color-text-error;
}
LESS example:
@import '@rei/cdr-tokens/dist/less/cdr-tokens.less'; /* import the desogn tokens file */
.your-default-text-class {
/* use mixins to apply many properties at once */
.cdr-text-default();
}
.your-other-text-class {
/* use variables if you need to apply specific properties */
color: @cdr-color-text-error;
}
JavaScript example:
import { CdrBreakpointLg } from '@rei/cdr-tokens'; /* import the design tokens file */
let screenWidth = window.innerWidth || 0;
// Detect Large Breakpoint
if (screenWidth >= CdrBreakpointLg) {
// Do Something
}
This repository follows SEMVER practices and will notify users of changes and updates on the #cedar-user-support Slack channel.
Is “cdr-color-text-primary used in several components or layouts? | Yes |
Is it clear where this is to be used based on its name? | Yes |
If I apply this design token in my component and use it to specify the color for primary text will it still be used for the primary text color in a future design update? | Yes |
Is this design token used for multiple elements and NOT specific to one element? | Yes |
Result: All of the criteria are met and so “cdr-color-text-primary qualifies as a design token.
Is “easily-excited” used in several components or layouts? | Yes |
Is it clear where this is to be used based on its name? | No |
If I apply this design token in my component and use it to specify a color will it still be used for that color in a future design update? | Yes |
Is this design token used for multiple elements and NOT specific to one element? | Perhaps but it is not used consistently |
Result: Only two criteria are met and so “easily-excited” does not qualify as a design token.
The naming structure for design tokens follows:
text
, color
, spacing
color-text
will define a color for text and can be used for iconsform
to indicate text used in a form controlform
could be modified by input
The below tables for the naming structure show that levels will be skipped when not used.
Category | Sub-Category | Item | Sub-Item | Variant | Size |
---|---|---|---|---|---|
color | text | input | label | ||
color | background | primary | |||
text | heading | serif | 800 |
If you have a request for a design token that is missing from the Cedar Tokens list you can submit a request to #cedar-user-support (opens new window) or come and talk to us during our weekly office hours.
Ensure that the design token meets the following requirements: