---
name: nuxt-ui-theming
description: Help customize Nuxt UI component themes and colors. Use when users ask about styling, theming, or customizing component appearance.
---
# Nuxt UI Theming Guide
Assist with customizing Nuxt UI component themes, colors, and appearance.
## When to Use
**DO USE** when:
- User wants to customize component appearance
- Questions about theme configuration
- Need to change colors or design tokens
- Want to create custom component variants
- Questions about the `ui` prop
**DO NOT USE** when:
- Basic component usage (covered in instructions)
- Finding which components exist (use nuxt-ui-component-finder)
## Theming Levels
### 1. Global Configuration (`nuxt.config.ts`)
```typescript
export default defineNuxtConfig({
ui: {
// Change component prefix (default: 'U')
prefix: 'Nuxt',
// Define theme colors
theme: {
colors: ['primary', 'secondary', 'success', 'error'],
transitions: true,
defaultVariants: {
color: 'primary',
size: 'md'
}
}
}
})
```
### 2. App Configuration (`app/app.config.ts`)
```typescript
export default defineAppConfig({
ui: {
// Global component defaults
button: {
default: {
color: 'primary',
size: 'md'
}
}
}
})
```
### 3. Component Level (`ui` prop)
```vue
Custom Button
```
### 4. Utility Classes (`class` prop)
```vue
Button with classes
```
## Color System
### Semantic Colors
Default semantic colors (configurable):
- `primary` - Main brand color
- `secondary` - Secondary brand color
- `success` - Success states (green)
- `error` - Error states (red)
- `warning` - Warning states (yellow/orange)
- `info` - Info states (blue)
- `neutral` - Neutral/gray
### Using Colors
```vue
Primary
Error
Success message
```
### Custom Colors
Add custom colors in Tailwind config:
```typescript
// nuxt.config.ts
export default defineNuxtConfig({
ui: {
theme: {
colors: ['primary', 'secondary', 'brand', 'accent']
}
}
})
```
## Component Customization
### Using `ui` Prop
The `ui` prop accepts an object matching the component's theme structure:
```vue
Custom Button
Header
Body content
```
### Slots-Based Theming
Components use slots for theme customization:
```vue
Custom Header Styling
Body with custom spacing
Custom Footer
```
## Common Patterns
### Creating Reusable Themed Components
```vue
```
### Dark Mode Styling
```vue
Dark mode aware
```
### Responsive Theming
```vue
Responsive padding
```
## Process
### User wants to customize a component:
1. Identify component (e.g., "Button")
2. Use `mcp_nuxt-ui_get-component-metadata` to see theme structure
3. Provide `ui` prop example for requested customization
4. Suggest global config if change should be app-wide
### User wants to change brand colors:
1. Explain semantic color system
2. Show `nuxt.config.ts` theme.colors configuration
3. Provide Tailwind color palette setup if needed
4. Show component usage with new colors
### User wants custom variants:
1. Get component theme structure
2. Show how to extend variants with `ui` prop
3. Suggest creating wrapper component for reuse
## Resources
- [Theming Documentation](https://ui.nuxt.com/docs/getting-started/theme)
- [Design System](https://ui.nuxt.com/docs/getting-started/theme/design-system)
- [Tailwind Variants](https://ui.nuxt.com/docs/getting-started/theme/tailwind-variants)
## Tips
- Use `ui` prop for component-level customization
- Use `app.config.ts` for app-wide defaults
- Use `class` prop for simple utility class additions
- Color placeholders like `{color}` are replaced at runtime
- Dark mode classes (`dark:`) work automatically with color mode
- Check component metadata for available theme slots