Nuxt
Add the Vue build of a component, keep Nuxt's aliases, and let the registry own the motion.
Prerequisites
You need Nuxt with Vue 3, Tailwind CSS v4 and an import alias. shadcn-vue's CLI writes components.json and the cn helper.
- Node.js 20 or newer.
- Nuxt 3 or 4 with the app directory you already use.
- Tailwind CSS v4 through the Vite plugin, not the Tailwind v3 module.
- An @/* alias that points at the project root, where the Vue CLI writes components. Nuxt's ~ alias still points at app/.
New app or existing app
Create a Nuxt app with the official starter, or keep yours. The included app/app.vue is enough for the first component.
Create a Nuxt app
npx nuxi@latest init my-app --template minimalExisting app? Skip the scaffold and add Tailwind CSS v4 before running the registry commands.
Configuration
Register Tailwind through Nuxt's Vite config, keep the stylesheet in app/assets/css/main.css, and point @/* at the project root. shadcn-vue writes Vue components to components/prequelui, so the alias has to see that folder; Nuxt's ~ alias still resolves inside app/. The two @source lines tell Tailwind v4 to scan the app directory and the root components folder. The Vue registry items carry their transitions, so there is no motion provider to add.
Install the runtime
npm install tailwindcss @tailwindcss/viteCreate components.json and the theme
npx shadcn-vue@latest init -t nuxt -dimport { fileURLToPath } from "node:url";
import tailwindcss from "@tailwindcss/vite";
export default defineNuxtConfig({
css: ["~/assets/css/main.css"],
alias: { "@": fileURLToPath(new URL("./", import.meta.url)) },
vite: { plugins: [tailwindcss()] },
});{
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": {
"paths": {
"@/*": ["./*"]
}
}
}@import "tailwindcss";
@source "../../";
@source "../../../components";Add a component
The Vue CLI reads components.json and writes the dialog to components/prequelui at the project root. Motion and @lucide/vue are installed as dependencies.
Add the animated component
npx shadcn-vue@latest add https://prequeluianimate.terravidhal.me/r/vue/dialog.json<script setup lang="ts">
import Dialog from "@/components/prequelui/Dialog.vue";
</script>
<template>
<div class="grid min-h-svh place-items-center">
<Dialog trigger="Open dialog" title="A Nuxt page" />
</div>
</template>Dark mode
Nuxt's color-mode module writes the class on <html>. Set classSuffix to an empty string so it matches the .dark variant used by the theme.
Add Nuxt Color Mode
npx nuxi@latest module add @nuxtjs/color-modeimport { fileURLToPath } from "node:url";
import tailwindcss from "@tailwindcss/vite";
export default defineNuxtConfig({
modules: ["@nuxtjs/color-mode"],
colorMode: { classSuffix: "" },
css: ["~/assets/css/main.css"],
alias: { "@": fileURLToPath(new URL("./", import.meta.url)) },
vite: { plugins: [tailwindcss()] },
});<script setup lang="ts">
const colorMode = useColorMode();
</script>
<template>
<button
class="rounded-md border px-3 py-1.5 text-[13px]"
@click="colorMode.preference = colorMode.value === 'dark' ? 'light' : 'dark'"
>
Toggle theme
</button>
</template>Verification
Open the page, trigger the dialog and watch the entrance. Then switch the theme and enable reduced motion in the OS.
- The dialog opens and closes from the trigger, with Escape working.
- The surface uses the theme tokens in both light and dark.
- Reduced motion removes the scale and blur, not the state change.
Start the dev server
npm run devMore Vue guides
All frameworks