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
| Property | Type | Description |
|---|---|---|
id | string | Unique identifier |
tokenset_id | string | Parent tokenset ID |
mode_id | string | Mode this token belongs to |
name | string | Token name (e.g., colors.primary.500) |
type | string | Token type (color, dimension, etc.) |
value | any | Token value |
description | string | Optional description |
alias_to | string | Reference to another token (for aliases) |
created_at | timestamp | Creation date |
updated_at | timestamp | Last update date |
Naming Convention
Tokencraft uses dot notation for hierarchical organization:Examples
Best Practices
✅ Good:colors.primary.500spacing.basefont.size.body
primaryColor500spacing_basefontSizeBody
Token Aliases
Tokens can reference other tokens using aliases:colors.button.primary will have the value of colors.primary.500.
Benefits of Aliases
- Semantic meaning:
colors.button.primaryis more meaningful thancolors.primary.500 - Easy updates: Change one value, update all references
- Consistency: Ensure related tokens stay in sync