Looking for the Vue version?
pnpm add @nuxt/ui
yarn add @nuxt/ui
npm install @nuxt/ui
bun add @nuxt/ui
If you're using pnpm, ensure that you either set shamefully-hoist=true in your .npmrc file or install tailwindcss in your project's root directory.
nuxt.config.tsexport default defineNuxtConfig({
modules: ['@nuxt/ui']
})
@import "tailwindcss";
@import "@nuxt/ui";
export default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css']
})
It's recommended to install the Tailwind CSS IntelliSense extension for VSCode and add the following settings:
{
"files.associations": {
"*.css": "tailwindcss"
},
"editor.quickSuggestions": {
"strings": "on"
},
"tailwindCSS.classAttributes": ["class", "ui"],
"tailwindCSS.experimental.classRegex": [
["ui:\\s*{([^)]*)\\s*}", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
]
}
<template>
<UApp>
<NuxtPage />
</UApp>
</template>
The App component provides global configurations and is required for Toast, Tooltip components to work as well as Programmatic Overlays.
To quickly get started with Nuxt UI, you can use the starter template by running:
npm create nuxt@latest -- -t ui
You can also get started with one of our official templates:
A minimal template to get started with Nuxt UI.
A modern landing page template powered by Nuxt Content.
A documentation template powered by Nuxt Content.
A SaaS template with landing, pricing, docs and blog powered by Nuxt Content.
A dashboard template with multi-column layout for building sophisticated admin interfaces.
An AI chatbot template to build your own chatbot powered by Nuxt MDC and Vercel AI SDK.
A sleek portfolio template to showcase your work, skills and blog powered by Nuxt Content.
A changelog template to display your repository releases notes from GitHub powered by Nuxt MDC.
You can use the Use this template button on GitHub to create a new repository or use the CLI:
npm create nuxt@latest -- -t ui
npm create nuxt@latest -- -t ui/landing
npm create nuxt@latest -- -t ui/docs
npm create nuxt@latest -- -t ui/saas
npm create nuxt@latest -- -t ui/dashboard
npm create nuxt@latest -- -t ui/chat
npm create nuxt@latest -- -t ui/portfolio
npm create nuxt@latest -- -t ui/changelog
You can customize Nuxt UI by providing options in your nuxt.config.ts.
prefixUse the prefix option to change the prefix of the components.
Uexport default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css'],
ui: {
prefix: 'Nuxt'
}
})
fontsUse the fonts option to enable or disable the @nuxt/fonts module.
trueexport default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css'],
ui: {
fonts: false
}
})
colorModeUse the colorMode option to enable or disable the @nuxt/color-mode module.
trueexport default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css'],
ui: {
colorMode: false
}
})
theme.colorsUse the theme.colors option to define the dynamic color aliases used to generate components theme.
['primary', 'secondary', 'success', 'info', 'warning', 'error']export default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css'],
ui: {
theme: {
colors: ['primary', 'error']
}
}
})
Learn more about color customization and theming in the Theme section.
theme.transitionsUse the theme.transitions option to enable or disable transitions on components.
trueexport default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css'],
ui: {
theme: {
transitions: false
}
}
})
This option adds the transition-colors class on components with hover or active states.
theme.defaultVariantsUse the theme.defaultVariants option to override the default color and size variants for components.
{ color: 'primary', size: 'md' }export default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css'],
ui: {
theme: {
defaultVariants: {
color: 'neutral',
size: 'sm'
}
}
}
})
theme.prefix Use the theme.prefix option to configure the same prefix you set on your Tailwind CSS import. This ensures Nuxt UI components use the correct prefixed utility classes and CSS variables.
export default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css'],
ui: {
theme: {
prefix: 'tw'
}
}
})
@import "tailwindcss" prefix(tw);
@import "@nuxt/ui";
You might need to enable fonts.processCSSVariables to use the prefix option with the @nuxt/fonts module:
export default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css'],
ui: {
theme: {
prefix: 'tw'
}
},
fonts: {
processCSSVariables: true
}
})
This will automatically prefix all Tailwind utility classes and CSS variables in Nuxt UI component themes:
<!-- Without prefix -->
<button class="px-2 py-1 text-xs hover:bg-primary/75">Button</button>
<!-- With prefix: tw -->
<button class="tw:px-2 tw:py-1 tw:text-xs tw:hover:bg-primary/75">Button</button>
Learn more about using a prefix in the Tailwind CSS documentation.
mdcUse the mdc option to force the import of Nuxt UI <Prose> components even if @nuxtjs/mdc or @nuxt/content is not installed.
falseexport default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css'],
ui: {
mdc: true
}
})
contentUse the content option to force the import of Nuxt UI <Prose> and <UContent> components even if @nuxt/content is not installed (@nuxtjs/mdc is installed by @nuxt/content).
falseexport default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css'],
ui: {
content: true
}
})
experimental.componentDetection Use the experimental.componentDetection option to enable automatic component detection for tree-shaking. This feature scans your source code to detect which components are actually used and only generates the necessary CSS for those components (including their dependencies).
falseboolean | string[]Enable automatic detection:
export default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css'],
ui: {
experimental: {
componentDetection: true
}
}
})
Include additional components for dynamic usage:
export default defineNuxtConfig({
modules: ['@nuxt/ui'],
css: ['~/assets/css/main.css'],
ui: {
experimental: {
componentDetection: ['Modal', 'Dropdown', 'Popover']
}
}
})
When providing an array of component names, automatic detection is enabled and these components (along with their dependencies) are guaranteed to be included. This is useful for dynamic components like <component :is="..." /> that can't be statically analyzed.
Nuxt UI uses pkg.pr.new for continuous preview releases, providing developers with instant access to the latest features and bug fixes without waiting for official releases.
Automatic preview releases are created for all commits and PRs to the v4 branch. Use them by replacing your package version with the specific commit hash or PR number.
{
"dependencies": {
- "@nuxt/ui": "^4.0.0",
+ "@nuxt/ui": "https://pkg.pr.new/@nuxt/ui@4c96909",
}
}
pkg.pr.new will automatically comment on PRs with the installation URL, making it easy to test changes.