Skip to main content
You are viewing Pre-Alpha documentation.
Vuetify0 Logo
Theme
Mode
Accessibility
Vuetify

Sign in

Sign in with your preferred provider to access your account.

createTokens

A utility for managing design tokens with support for hierarchical collections, aliases, and token resolution across your application’s design system. Inspired by Design Tokens↗.


Advanced99.6% coverageBlazing FastFeb 4, 2026

Usage

The createTokens composable allows you to define a collection of design tokens, which can be primitive values or aliases that reference other tokens. It provides a context for resolving these tokens, making it easy to access design values throughout your application.

ts
import { createTokens } from '@vuetify/v0'

// Default behavior (depth = Infinity): fully flatten nested objects
const tokens = createTokens({
  color: {
    primary: '#3b82f6',
    secondary: '#64748b',
    info: '{primary}'
  },
  radius: {
    sm: '4px',
    md: '8px',
  },
})

tokens.resolve('color.primary') // '#3b82f6'
tokens.resolve('color.info') // '#3b82f6' (alias resolved)
tokens.resolve('radius.md') // '8px'

const features = createTokens({
  dark: true,
  rtl: { value: true, variation: 'toggle' },
}, { flat: true })

// With flat: true, nested objects are kept as-is at their base id
features.resolve('rtl') // { value: true, variation: 'toggle' }

Reactivity

createTokens uses minimal reactivity like its parent createRegistry. Token resolution is cached but not reactive.

Tip

For reactive theming Use useTheme which builds on createTokens with proper reactivity for theme switching.

Architecture

createTokens extends createRegistry and powers token-based systems:

Tokens Hierarchy

Use controls to zoom and pan. Click outside or press Escape to close.

Tokens Hierarchy

API Reference

The following API details are for the createTokens composable.

Functions

createTokens

(tokens?: TokenCollection, options?: TokenOptions) => E

Creates a new token instance.

createTokensContext

(_options: TokenContextOptions) => ContextTrinity<E>

Creates a new token context.

useTokens

(namespace?: string) => E

Returns the current tokens instance.

Frequently Asked Questions

Benchmarks

Every operation is profiled across multiple dataset sizes to measure real-world throughput. Each benchmark is assigned a performance tier—good, fast, blazing, or slow—and groups are scored by averaging their individual results so you can spot bottlenecks at a glance. This transparency helps you make informed decisions about which patterns scale for your use case. Learn more in the benchmarks guide.

View benchmark source↗

Was this page helpful?

© 2016-1970 Vuetify, LLC
Ctrl+/