Architecture
The design system consists of three main layers:- CSS Variables - Semantic design tokens defined in CSS
- Tailwind Variants - Component-level theme definitions
- Runtime Configuration - Dynamic theme customization via
app.config.ts
Color System
Color Aliases
Nuxt UI uses semantic color aliases that map to actual color values. By default, the following color aliases are available:nuxt.config.ts:
[nuxt.config.ts]
Default Color Mapping
The default color mapping inapp.config.ts is:
[app.config.ts]
Semantic Color Tokens
Nuxt UI provides semantic color tokens that automatically adapt to light and dark modes: Text Colors:text-dimmed- Dimmed text (neutral-400 in light, neutral-500 in dark)text-muted- Muted text (neutral-500 in light, neutral-400 in dark)text-toned- Toned text (neutral-600 in light, neutral-300 in dark)text-default- Default text (neutral-700 in light, neutral-200 in dark)text-highlighted- Highlighted text (neutral-900 in light, white in dark)text-inverted- Inverted text (white in light, neutral-900 in dark)
bg-default- Default background (white in light, neutral-900 in dark)bg-muted- Muted background (neutral-50 in light, neutral-800 in dark)bg-elevated- Elevated background (neutral-100 in light, neutral-800 in dark)bg-accented- Accented background (neutral-200 in light, neutral-700 in dark)bg-inverted- Inverted background (neutral-900 in light, white in dark)
ring-default- Default border (neutral-200 in light, neutral-800 in dark)ring-muted- Muted border (neutral-200 in light, neutral-700 in dark)ring-accented- Accented border (neutral-300 in light, neutral-700 in dark)ring-inverted- Inverted border (neutral-900 in light, white in dark)
Size Variants
Most components support standardized size variants:[nuxt.config.ts]
Component Variants
Components typically support these visual variants:- solid - Filled background with the color
- outline - Transparent background with colored border
- soft - Light background with colored text
- subtle - Light background with border and colored text
- ghost - Transparent with hover states
- link - Text-only appearance
Not all variants are available on all components. Check individual component documentation for supported variants.
Tailwind Variants
Each component’s theme is defined using Tailwind Variants insrc/theme/*.ts files. Here’s an example from the Button component:
[src/theme/button.ts]
Transitions
Transitions can be globally enabled or disabled:[nuxt.config.ts]
Tailwind CSS Prefix
You can prefix all Tailwind utility classes to avoid conflicts:[nuxt.config.ts]
tw:, resulting in classes like tw:bg-primary and tw:text-sm.
Design Tokens
Nuxt UI uses CSS variables as design tokens, making it easy to customize the entire design system. Key tokens include:Best Practices
Use semantic colors
Always use semantic color tokens like
text-default and bg-elevated instead of raw Tailwind palette colors like text-gray-500.Leverage color aliases
Use color aliases (
primary, secondary, etc.) for components to maintain consistency and enable easy theme switching.Override at the right level
Use CSS variables for global changes,
app.config.ts for color mappings, and component-level overrides for specific customizations.Related
CSS Variables
Customize design tokens and CSS variables
Component Theming
Learn how to theme individual components
Customization Guide
Advanced theme customization techniques