Skip to content

tokens naming schema

Ali Stump edited this page Nov 27, 2024 · 3 revisions

tags: [tokens]

Tokens Schema

Using the token naming schema we can define individual design decisions and catalogue them for consistency across team(s) or business(es).

Calcite tokens extend the W3C Design Token Working Group model and each token always has the following properties.

tier type

timeline
    title Naming Schema
    section Namespace
        System : calcite
        Tier : core : global : web-platform
        Domain : internal
    section Object
        Component : button : action : dropdown
        Element : heading : description : content
        Type : color : corner-radius : space : size
    section Base
        Group : brand : status
        Kind : info : success : danger
        Appearance : transparent : outline : round : start : end
    section Modifier
        Scale : lg : md : sm : 1 : 2 : 3
        State : hover : focus : active : selected
        Context : color
        Mode : light : dark
Loading

Namespace

System

The Calcite Design System was designed for Esri teams and our customers to support the use of Esri apps and tools.

Tier

The categories of the design system that group tokens by their usage patterns.

Core tier

Core tier tokens (also known as foundation or base tokens). Their main role in the system are to store all raw values. This is the level that state all options available first and with it build the ground base options of the design system. This tier is responsible for the look of the final product by defining all the values that can be used across the whole tokens ecosystem. Tokens in this tier are intended to be used as references on semantic and component tier tokens.

Global tier

Global tier tokens help associate meaning, context, and/or intent to the design tokens across an entire domain. Tokens in this tier do not use raw values like “16px” or “8%”, and so on. They should always reference a Core token instead. Their name represents the decisions the design system team made in regards to when to their intended use.

Component tier

Component tokens are platform specific. They may have string and compound values but should not use raw values like “16px” or “#fff” but instead should reference other tier tokens - core and global. Component tokens represent component level visual pattern decisions. The names should be clearly understandable and be as specific as possible in order to be applied in component development. Component tokens may be considered by customer request to provide better theme customization. Current component level tokens may be applied to the following CSS properties on the web.

  • border-color: should reference a color token.
  • color: should reference a color.text token.
  • background-color: should reference a color token.
  • border-radius: should reference a corner.radius token.
  • box-shadow: should reference a shadow token unless a component token is only provided for the box-shadow-color, in which case it can reference any color token.

Tokens on this tier may be specific to a component's variants and/or states.

Domain

The sets of tokens under a team name. Calcite reserves 'internal' for internal team tokens. Domain tokens should within the system should still follow Calcite Design System best practices.

Object

Component

A specific custom component the token is applied to.

Element

Element(s) within the component with it’s own internal state.

Type

A predefined categorization applied to the token’s value which defines the purpose of the token.

Breakpoints

Tokens which define the container breakpoints on various devices. Not used in Figma.

Color

Tokens are used across all the system and can be found in all of the token tiers for multiple purposes. You can use color tokens to create new color styles, update color styles across the system or apply them to a fill or stroke.

Corner-radius

Defines the "roundness" of a components edges. Can be applied to all corners, or to a specific corner like “top-right”, “top-left”, “bottom-right”, “bottom-left”.

Font-Family

Names used in the application to define font families. This is just a name reference, the appropriate asset files will need to be loaded separately. Not used in Figma.

Font-weight

Typographic ordinal naming for weight scales which may be converted to numeric values for certain platforms. Not used in Figma.

Font-size

Only found in the semantic tier. These are set as static values but will be exported as relative values for the web platform.

Line-height

These are set as static values which may be exported as relative values for certain platform.

Opacity

tokens which define set opacity percentages used across the design system. Not used in Figma.

Shadow

Defines an effect style either simple with one single level of shadow or an array of multiple shadows. These can be used combined with other tokens like colors or dimensions to create references and stay updated along the evolution of the design system.

Size

Used to create tokens that define the width, height, or both. They can also be used to set min-widths or max-widths depending on the need and to set specific breakpoint sizes.

Space

Spacing tokens define values like paddings, margins, and gutters. They can be used to define space all-around, to a gap, or to a specific side of the element or component to build.

z-index (stack)

Sets the stacking layer for UI elements. Not used in figma.

Base

Group

A set of tokens belonging to a specific category.

Kind

A variant of tokens belonging to a specific group.

Appearance

A variant of tokens belonging to s specific visual group.

Modifier

Scale

Regarding scales, we can use numeric, ordinal (especially helpful for small scales with around five items), or customized scales according to the needs.

Enumerated:

Use for scales with a large number of tokens. Example -0, 1, 2, 3 ... [list tokens where scale is numerical]

Ordinal

Used for scales of five tokens or less. Example - lg, md, sm, ... [list tokens where scale is ordinal]

Ordered

50, 60, 70, 100, ... 900

Bounded

level-1, level-2, level-3

Force

thin, light, regular ... snug, tight

State

Mutually exclusive user interaction inaction variations. This might include web specific pseudo classes like :hover, :focus, and :active but also include disabled and more generalized interaction states like highlight and selected.

Mode

Mutually exclusive variations within a specific type.

Clone this wiki locally