Overview
Design token registry with automatic alias resolution, nested token flattening, and W3C Design Tokens format support. Features circular reference detection, path-based resolution with dot notation, and resolution caching for performance.Basic Usage
Function Signature
Parameters
Nested object containing design tokens
Returns
Token context with resolution methods
Resolve a token or alias to its value
Check if a value is an alias reference
Add a new token dynamically
Update or create a token
Remove a token by ID
Access underlying registry methods
Number of registered tokens
Alias Resolution
Simple Aliases
Reference other tokens using{tokenPath} syntax:
Nested Aliases
Resolve tokens from nested paths:Chained Aliases
Aliases can reference other aliases:Circular Reference Detection
Prevents infinite loops with warning:W3C Design Tokens Format
Token Metadata
Supports W3C Design Tokens specification:Complex Values
Tokens can contain objects as values:Path-Based Resolution
Dot Notation
Access nested tokens with dot notation:Partial Path Resolution
Resolve segments within token values:Dynamic Token Management
Adding Tokens
Updating Tokens
Removing Tokens
Prefixing
Namespace all tokens with a prefix:Context Pattern
Use dependency injection for global token access:TypeScript
Token Types
Primitive Values
Tokens support all primitive types:Performance
Resolution Caching
Resolved values are automatically cached:Related
- useTheme - Theme system built on tokens
- useLocale - Locale system using tokens
- createRegistry - Base registry primitive