shadcn-nuxt is a Nuxt.js module designed to seamlessly integrate shadcn/ui components (specifically the Vue implementation, shadcn-vue) into Nuxt 3 applications. It automates the setup and configuration process, offering features like automatic import of components into your Nuxt project, abstracting away manual configuration of Tailwind CSS and component paths. The current stable version is 2.6.2, with frequent bug fixes and feature enhancements, indicating an active development cycle. Key differentiators include its robust auto-import mechanism, support for multiple component directories with custom prefixes, and alignment with the upstream shadcn-ui API for consistency. It aims to simplify the developer experience by providing a pre-configured solution for using shadcn-vue's UI library within the Nuxt ecosystem.
npm install shadcn-nuxtVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to install `shadcn-nuxt` as a Nuxt module and configure it in `nuxt.config.ts`, followed by a basic example of using an auto-imported Shadcn Vue component in an application.
Consult the official `shadcn-vue` documentation and `shadcn-nuxt` changelog for specific migration steps. Re-evaluate your `nuxt.config.ts` `shadcn` configuration and component usage.
Ensure all custom component directories intended for Shadcn Vue components are explicitly listed within the `shadcn.componentDir` array in `nuxt.config.ts`. Utilize prefixes for clarity and to prevent naming conflicts.
After installing `shadcn-nuxt` and configuring it, use the `shadcn-vue` CLI (or the integrated Nuxt CLI command if available) to add desired components to your project's configured `componentDir` (e.g., `npx shadcn-vue add button`).
Ensure you are on `shadcn-nuxt` version `2.6.2` or higher to benefit from improved alias resolution. Double-check your `tsconfig.json` paths and `shadcn.componentDir` configuration for consistency. Manually verify the generated component paths after running `npx shadcn-vue add`.
Ensure `shadcn-nuxt` is installed as a dev dependency (`pnpm add -D shadcn-nuxt` or `npm install --save-dev shadcn-nuxt`) and that `nuxt.config.ts` is a TypeScript file.
Run `npx shadcn-vue add <ComponentName>` to scaffold the component into your project. Verify that `shadcn.componentDir` in `nuxt.config.ts` correctly points to the directory where your shadcn-vue components reside (e.g., `./components/ui`).
Run `npx shadcn-vue add <ComponentName>` to scaffold the component into your project. Verify that `shadcn.componentDir` in `nuxt.config.ts` correctly points to the directory where your shadcn-vue components reside (e.g., `./components/ui`).
Ensure Tailwind CSS is correctly installed and configured in your Nuxt project, including `postcss.config.js`. Verify that `shadcn-nuxt` is listed in your `modules` array. If you have a custom Tailwind configuration, check for conflicts with how `shadcn-nuxt` expects it to be set up. Consult the `shadcn-nuxt` documentation for specific Tailwind integration steps.