Tokens
Design tokens in Roadie v2 are CSS custom properties defined via Tailwind v4's @theme directive. They provide a single source of truth for colors, typography, spacing, and theming — automatically supporting dark mode via the .dark class.
How tokens work
Tokens are defined in packages/core/src/css/tokens.css and consumed via Tailwind utility classes or CSS custom properties:
/* Import in your app's CSS */@import '@oztix/roadie-core/css';
{/* Use via intent + emphasis utilities */}<div className="intent-accent emphasis-subtle text-normal p-4 rounded-xl">Content using the intent/emphasis system</div>
Token layers
1. Color scales (primitive)
Raw OKLCH color values in 14 steps (0-13) per scale. Available scales:
- neutral — grays for UI structure
- brand — Oztix Blue (fixed)
- brand-secondary — Oztix Orange (fixed)
- accent — customizable per collection (defaults to brand)
- danger — red for errors and destructive actions
- success — green for positive outcomes
- warning — yellow for caution states
- info — purple for informational states
Usage: bg-neutral-3, text-accent-11, border-danger-7
2. Intent system (semantic)
Intent utilities set --intent-* CSS custom properties that provide the color context. Children inherit the intent via CSS cascade:
Each intent exposes:
- Surface:
--intent-surface-default(step 1),subtle(3),subtler(2),strong(9),inverted(12),raised(0),sunken(2) - Border:
--intent-border-subtler(5),subtle(6),default(7),strong(9) - Foreground:
--intent-fg-subtler(10),subtle(11),default(12),strong(13),inverted(0) - Raw steps:
--intent-0through--intent-13for granular access
3. Emphasis system (visual)
Emphasis utilities consume intent tokens to apply visual styles:
4. Typography
Fluid font sizes with clamp() from lg upward, plus pre-composed text style utilities:
Dark mode
All tokens automatically adapt via the .dark class on <html>. The OKLCH color values swap — step numbers stay the same but perceptual weight inverts. No dark: Tailwind variants needed for colors.
Dynamic accent color
The accent scale can be overridden at runtime for per-collection branding:
import { ThemeProvider } from '@oztix/roadie-components'<ThemeProvider defaultAccentColor="#FF6B00">{/* All intent-accent elements use orange */}</ThemeProvider>
For SSR, use getAccentStyleTag() to inject colors server-side and avoid flash.
Best practices
- Use intent + emphasis for component colors — not raw scale steps
- Use Tailwind utilities for spacing and layout (
p-4,gap-2,grid) - Let dark mode happen automatically — the token system handles it
- Use the accent intent for primary actions — it adapts to dynamic theming
- Use neutral intent for structural UI — it's the default, no class needed on
:root
For a complete reference of all available tokens, see the Token reference page.