Skip to main content

Tokens

Design tokens are the atomic values in your design system. They represent visual design decisions as data, making them easy to share, maintain, and apply across platforms.

What is a Token?

A design token is a named entity that stores a visual design attribute. Instead of hard-coding values like #3b82f6 or 16px throughout your code, you reference them by name like colors.primary.500 or spacing.base.

Example

Token Types

Tokencraft supports all W3C Design Token types:

Color

Dimension

Font Family

Font Weight

Font Size

Duration

Cubic Bezier

Shadow

Border

Typography

Token Properties

Naming Convention

Tokencraft uses dot notation for hierarchical organization:

Examples

Best Practices

Good:
  • colors.primary.500
  • spacing.base
  • font.size.body
Bad:
  • primaryColor500
  • spacing_base
  • fontSizeBody

Token Aliases

Tokens can reference other tokens using aliases:
When resolved, colors.button.primary will have the value of colors.primary.500.

Benefits of Aliases

  1. Semantic meaning: colors.button.primary is more meaningful than colors.primary.500
  2. Easy updates: Change one value, update all references
  3. Consistency: Ensure related tokens stay in sync

Creating Tokens

Token Organization

By Category

Group related tokens:

By Component

Organize by UI component:

By Scale

Use numeric scales for consistency:

Working with Tokens

Listing Tokens

Getting a Specific Token

Updating a Token

Deleting a Token

Token Resolution

Tokencraft automatically resolves token aliases:

Using Tokens in Code

CSS Variables

JavaScript/TypeScript

React Native

Next Steps

Export Formats

Export tokens in various formats

API Reference

Explore token endpoints

Integrations

Use tokens in your projects