To integrate UI components generated by v0 into an existing Next.js and Tailwind CSS application, the most reliable workflow is running the shadcn CLI command provided in the v0 interface (npx shadcn@latest add "<v0-url>"). This pulls the component directly into your directory, resolves dependencies, and aligns with shadcn design tokens. Alternatively, you can manually copy the TSX code or connect GitHub to receive automated Pull Requests.
However, having Tailwind CSS and Next.js installed is not enough on its own. v0 components rely on semantic CSS variables, utility helper functions, and specific Radix UI primitives. At 365Finds, our evaluation shows that failing to calibrate these foundational files causes broken styles and invisible UI elements in existing repositories.
Prerequisites: What v0 Assumes About Your Repository
v0 by Vercel does not output bare HTML or generic Tailwind classes. It generates React code built on three core assumptions:
- Next.js App Router (or Pages Router) with TypeScript: The generated code uses TypeScript (
.tsx) and frequently includes'use client'directives. - Tailwind CSS with CSS Variable Theming: Components use semantic utility classes like
bg-background,text-foreground,border-border, andring-offset-background. These classes map to CSS custom properties defined in your global stylesheet, not fixed color palettes. - The
cn()Utility: Code importscnfrom@/lib/utilsto merge conditional class names viaclsxandtailwind-merge.
If your existing project lacks these primitives, you must set them up before importing any component.
npm install clsx tailwind-merge lucide-react class-variance-authority
Ensure @/lib/utils.ts contains the standard helper:
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
Method 1: The shadcn CLI Route (365Finds Recommended)
For adding isolated components—such as a pricing card, a settings modal, or a dashboard sidebar—into an existing project, 365Finds recommends using the shadcn CLI integration over manual copying.
Step 1: Copy the Command from v0
- Open your chat session in v0.
- Click the Add to codebase (or CLI icon) button located above the component preview.
- Copy the generated command string. It follows this structure:
npx shadcn@latest add "https://v0.dev/chat/b/<PROJECT_ID>?token=<YOUR_TOKEN>"
Step 2: Initialize shadcn (If Not Already Done)
If your project does not yet have a components.json configuration file, run:
npx shadcn@latest init
Select your style, base color, and CSS file path (app/globals.css). This configures your import aliases and base theme variables.
Step 3: Run the Add Command
Execute the copied command in your local project root:
npx shadcn@latest add "https://v0.dev/chat/b/<PROJECT_ID>?token=<YOUR_TOKEN>"
The CLI inspects the remote v0 schema, detects which dependencies and atomic UI primitives are required (such as @radix-ui/react-dialog or button.tsx), installs missing packages via your package manager, and places the component file into your configured components/ directory.
Method 2: Manual Code Extraction (ZIP or Copy-Paste)
When working in environments with restricted external network access or when you prefer not to execute CLI installation scripts, manual code export is the straightforward alternative.
Step 1: Export Code from v0
In the v0 interface:
- Single Component: Switch from the preview tab to the Code tab, click Copy, and create a new file (e.g.,
components/v0-feature-card.tsx). - Complete Layout: Click the three-dot menu next to the version selector and choose Download ZIP. Extract the folder to inspect the source structure.
Step 2: Install Required Dependencies
Review the top import statements of the component. v0 typically relies on:
npm install @radix-ui/react-slot @radix-ui/react-dropdown-menu lucide-react
Step 3: Align Theme Variables in globals.css
If your component renders with white text on a white background or transparent borders, your globals.css is missing shadcn semantic color tokens. Add the required CSS variables inside @layer base:
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;
--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;
--primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--ring: 222.2 84% 4.9%;
--radius: 0.5rem;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--card: 222.2 84% 4.9%;
--card-foreground: 210 40% 98%;
--popover: 222.2 84% 4.9%;
--popover-foreground: 210 40% 98%;
--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 11.2%;
--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;
--muted: 217.2 32.6% 17.5%;
--muted-foreground: 215 20.2% 65.1%;
--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;
--border: 217.2 32.6% 17.5%;
--input: 217.2 32.6% 17.5%;
--ring: 212.7 26.8% 83.9%;
}
}
Method 3: GitHub Integration (Bi-directional Branching)
For greenfield prototypes or dedicated sub-pages, v0 provides native GitHub connectivity:
- In your v0 project settings, link your GitHub organization and select target repository.
- When you request changes or approve an iteration, v0 generates a dedicated branch (e.g.,
v0/main-feature-123) and opens a Pull Request against your target branch. - You review the PR diff directly in GitHub or pull the branch locally:
git fetch origin
git checkout v0/main-feature-123
365Finds advises against using the GitHub PR sync on core production branches of complex applications. v0 often pushes full layout wrappers and modified global configurations that can overwrite existing routing and provider trees.
Integration Comparison
| Method | Best For | Advantages | Potential Friction |
|---|---|---|---|
| shadcn CLI | Individual components; specific UI blocks | Resolves dependencies automatically; matches project aliases | Requires valid token; requires components.json |
| Manual Copy / ZIP | Air-gapped repos; custom architectures | Full visibility into imported code; zero external tooling | Must manually resolve missing packages and CSS variables |
| GitHub PR Sync | New pages; rapid iterative prototypes | Automated branch creation; clean git review flow | High risk of overwriting existing app-level layouts |
Critical Refactoring Steps Before Production
Once the component is inside your Next.js project, 365Finds recommends completing three refactoring tasks before merging code:
- Extract Hardcoded Mock Data: v0 inserts static JSON objects directly inside component bodies. Decouple these into TypeScript interface definitions and pass data through component props.
- Audit
'use client'Directives: v0 defaults to marking entire components as client-side modules to support interactive toggles and Lucide icons. Split the component into a static Next.js Server Component shell and extract interactive elements into smaller Client Components. - Verify Tailwind v4 vs v3 Configurations: In Tailwind CSS v3, ensure
tailwind.config.tsincludescontentpaths covering your imported v0 files. In Tailwind CSS v4 setups, confirm that@thememappings correctly resolve CSS color variables without relying on deprecated plugins.