ReferenceComponentscomponentsstylingvariantsnuxt-uicheat-sheet

Nuxt UI Component Styling Cheat Sheet

Quick reference for customizing individual Nuxt UI v4 components using variants, colors, sizes, and theme tokens.

A quick-reference guide for styling Nuxt UI v4 components. Every component follows the same patterns - learn them once, apply them everywhere.

Universal Props

Most Nuxt UI components accept these styling props:

PropTypeDescription
colorstringSemantic color: primary, secondary, success, warning, error, neutral
variantstringVisual style: solid, outline, soft, subtle, ghost, link
sizestringSize scale: xs, sm, md, lg, xl
classstringTailwind classes for the root element
uiobjectOverride internal component styles

Button Variants

<!-- Solid: filled background, white text -->
<UButton label="Save" color="primary" variant="solid" />

<!-- Outline: transparent bg, colored border and text -->
<UButton label="Cancel" color="neutral" variant="outline" />

<!-- Soft: light colored background, colored text -->
<UButton label="Info" color="primary" variant="soft" />

<!-- Subtle: very light tint, colored text -->
<UButton label="Details" color="primary" variant="subtle" />

<!-- Ghost: transparent, colored text, hover background -->
<UButton label="Skip" color="neutral" variant="ghost" />

<!-- Link: no background or border, underline on hover -->
<UButton label="Learn more" color="primary" variant="link" />

Alert Variants

<UAlert
  title="Success!"
  color="success"
  variant="soft"
  icon="i-lucide-check-circle"
/>
<UAlert
  title="Warning"
  color="warning"
  variant="outline"
  icon="i-lucide-alert-triangle"
/>
<UAlert title="Error" color="error" variant="solid" icon="i-lucide-x-circle" />

Badge Styling

<UBadge label="New" color="primary" variant="solid" />
<UBadge label="Draft" color="neutral" variant="outline" />
<UBadge label="Active" color="success" variant="soft" />
<UBadge label="2" color="error" variant="subtle" size="xs" />

Input Customization

<!-- Standard input with icon -->
<UInput placeholder="Search..." icon="i-lucide-search" size="md" />

<!-- Input with custom colors (uses theme primary) -->
<UInput placeholder="Email" color="primary" variant="outline" />

<!-- Input with validation error state -->
<UFormField label="Email" :error="'Invalid email address'">
  <UInput placeholder="you@example.com" />
</UFormField>

Card Styling

<UCard class="shadow-sm">
  <template #header>
    <h3 class="text-lg font-semibold">Card Title</h3>
  </template>
  <p>Card content goes here.</p>
  <template #footer>
    <div class="flex justify-end gap-2">
      <UButton label="Cancel" variant="ghost" color="neutral" />
      <UButton label="Save" variant="solid" color="primary" />
    </div>
  </template>
</UCard>

The ui Prop for Deep Customization

Every component's internal elements can be styled via the ui prop:

<UButton
  label="Custom Button"
  :ui="{
    base: 'font-bold tracking-wide uppercase',
  }"
/>

The ui prop keys vary per component. Check the Nuxt UI docs for each component's available slots.

Theming with app.config.ts

Global component defaults can be set in your app config:

export default defineAppConfig({
  ui: {
    button: {
      defaultVariant: "solid",
      defaultSize: "md",
    },
  },
});

Color Hierarchy Pattern

A recommended approach for consistent component coloring:

Primary actions    → color="primary"   variant="solid"
Secondary actions  → color="primary"   variant="outline"
Tertiary actions   → color="neutral"   variant="ghost"
Info/hints         → color="primary"   variant="soft"
Success feedback   → color="success"   variant="soft"
Warning feedback   → color="warning"   variant="soft"
Error feedback     → color="error"     variant="soft"
Destructive action → color="error"     variant="solid"

Size Scale Reference

SizeHeightFontPaddingUse Case
xs24px12pxcompactInline badges, tight UIs
sm32px13pxsnugSecondary actions, toolbars
md36px14pxnormalDefault for most contexts
lg40px15pxrelaxedPrimary CTAs, forms
xl44px16pxgenerousHero sections, landing pages

Preview Components with Your Theme

The Nuxt UI Theme Builder renders every component variant with your active theme. Change a color, see it update across all buttons, alerts, badges, and inputs instantly.

Jump straight to a component to see these props in action: Button, Badge, Alert, Input, or Card. The full list lives on the Components page.

Next Steps