Skip to main content
RapidDev - Software Development Agency
v0-issues

Customizing component names and structure in V0

V0 generates components with generic names like Card1, HeroSection2, or MyComponent that make large projects hard to navigate. Rename components and reorganize the file structure directly in the V0 code editor by using the file explorer's rename function and updating all import paths. Follow a consistent naming convention — PascalCase for components, kebab-case for file names — and group related components into feature directories to keep V0 projects maintainable as they grow.

Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner6 min read10-20 minutesV0 with Next.js App Router, any project sizeMarch 2026RapidDev Engineering Team
TL;DR

V0 generates components with generic names like Card1, HeroSection2, or MyComponent that make large projects hard to navigate. Rename components and reorganize the file structure directly in the V0 code editor by using the file explorer's rename function and updating all import paths. Follow a consistent naming convention — PascalCase for components, kebab-case for file names — and group related components into feature directories to keep V0 projects maintainable as they grow.

Why V0 generates generic component names and flat file structures

V0 creates components based on your prompt description and generates names from the prompt context. When you iterate on the same component across multiple prompts, V0 often appends numbers (HeroSection, HeroSection2) or uses overly generic names (MyComponent, ContentBlock). The file structure is usually flat — all components land in /components at the root level. As your project grows beyond a few pages, this makes it difficult to find and maintain components. Renaming and reorganizing early prevents confusion and import errors later, especially when collaborating with other developers or exporting to GitHub.

  • V0 names components based on prompt keywords, resulting in generic or duplicated names
  • Multiple iterations on the same component create numbered variants like Card1, Card2
  • All components are placed in a flat /components directory regardless of feature or page
  • V0 does not enforce naming conventions — PascalCase, camelCase, and kebab-case are mixed
  • Exporting to GitHub with inconsistent names makes the codebase hard to understand for other developers

Error messages you might see

Module not found: Error: Can't resolve '@/components/ui/hero-section-2'

After renaming a component file, import paths throughout the project still reference the old file name. Update all imports to match the new file name.

Attempted import error: 'HeroSection' is not exported from '@/components/hero-section' (imported as 'HeroSection').

The component was renamed inside the file but the export name does not match what other files are importing. Ensure the exported name matches all import statements.

Before you start

  • A V0 project with components you want to rename or reorganize
  • Access to the V0 code editor and file explorer
  • Basic understanding of import/export syntax in TypeScript

How to fix it

1

Rename component files using the file explorer

File names should describe what the component does and follow a consistent convention. Generic names like MyComponent.tsx or Card1.tsx provide no context about the component's purpose.

Open the V0 file explorer (Shift+Cmd+E). Right-click the component file and select Rename. Use kebab-case for file names (pricing-card.tsx, not PricingCard.tsx). After renaming, update the component name inside the file to match using PascalCase.

Before
typescript
// components/Card1.tsx
export function Card1() {
return (
<div className="rounded-lg border p-6">
<h3>Premium Plan</h3>
<p>$29/month</p>
</div>
);
}
After
typescript
// components/pricing-card.tsx
export function PricingCard() {
return (
<div className="rounded-lg border p-6">
<h3>Premium Plan</h3>
<p>$29/month</p>
</div>
);
}

Expected result: The file has a descriptive name and the exported component uses PascalCase.

2

Update all import paths after renaming

After renaming a component file or changing its export name, every file that imports it must be updated to reference the new path and name. Missing updates cause module-not-found build errors.

Use the V0 editor's global search (Shift+Cmd+F) to find all references to the old component name or file path. Update each import statement to the new name.

Before
typescript
// app/pricing/page.tsx — old import
import { Card1 } from "@/components/Card1";
export default function PricingPage() {
return <Card1 />;
}
After
typescript
// app/pricing/page.tsx — updated import
import { PricingCard } from "@/components/pricing-card";
export default function PricingPage() {
return <PricingCard />;
}

Expected result: All imports reference the renamed component and the app builds without errors.

3

Organize components into feature-based directories

A flat /components directory becomes unmanageable in projects with more than 10-15 components. Grouping components by feature (auth, dashboard, marketing) makes navigation easier.

Create subdirectories inside /components for each feature area. Move related components into their respective directories. Keep shared UI components from shadcn/ui in /components/ui.

Before
typescript
// Flat structure — hard to navigate
components/
hero-section.tsx
feature-grid.tsx
pricing-card.tsx
login-form.tsx
signup-form.tsx
dashboard-header.tsx
dashboard-sidebar.tsx
ui/button.tsx
ui/card.tsx
After
typescript
// Feature-based structure — organized and scalable
components/
marketing/
hero-section.tsx
feature-grid.tsx
pricing-card.tsx
auth/
login-form.tsx
signup-form.tsx
dashboard/
dashboard-header.tsx
dashboard-sidebar.tsx
ui/
button.tsx
card.tsx

Expected result: Components are grouped by feature and easy to find when the project scales.

4

Ask V0 to follow your naming conventions in future prompts

V0 uses your existing code as context for new generations. If you establish a convention early and reference it in prompts, V0 is more likely to follow it for new components.

Include naming instructions in your prompts when asking V0 to generate new components. Reference existing files as examples of the convention you want followed.

Before
typescript
// Prompt without naming guidance:
// "Create a testimonial section"
After
typescript
// Prompt with naming guidance:
// "Create a testimonial section. Name the component TestimonialCarousel
// and save it to components/marketing/testimonial-carousel.tsx.
// Follow the same naming convention as @components/marketing/hero-section.tsx"

Expected result: V0 generates the component with the specified name and file path.

Complete code example

components/marketing/pricing-card.tsx
1import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
2import { Button } from "@/components/ui/button";
3import { Badge } from "@/components/ui/badge";
4import { Check } from "lucide-react";
5
6interface PricingCardProps {
7 name: string;
8 price: number;
9 description: string;
10 features: string[];
11 popular?: boolean;
12}
13
14export function PricingCard({
15 name,
16 price,
17 description,
18 features,
19 popular = false,
20}: PricingCardProps) {
21 return (
22 <Card className={popular ? "border-primary shadow-lg" : ""}>
23 <CardHeader>
24 <div className="flex items-center justify-between">
25 <CardTitle>{name}</CardTitle>
26 {popular && <Badge>Popular</Badge>}
27 </div>
28 <p className="text-sm text-muted-foreground">{description}</p>
29 <p className="text-3xl font-bold mt-2">${price}/mo</p>
30 </CardHeader>
31 <CardContent className="space-y-4">
32 <ul className="space-y-2">
33 {features.map((feature) => (
34 <li key={feature} className="flex items-center gap-2 text-sm">
35 <Check className="h-4 w-4 text-primary" />
36 {feature}
37 </li>
38 ))}
39 </ul>
40 <Button className="w-full" variant={popular ? "default" : "outline"}>
41 Get Started
42 </Button>
43 </CardContent>
44 </Card>
45 );
46}

Best practices to prevent this

  • Use PascalCase for component names (PricingCard) and kebab-case for file names (pricing-card.tsx)
  • Group components into feature directories (marketing/, auth/, dashboard/) under /components
  • Keep shadcn/ui components in /components/ui and never rename them — other tools expect the standard paths
  • Use global search (Shift+Cmd+F) to find all references before renaming any component
  • Define TypeScript interfaces for component props using descriptive names like PricingCardProps
  • Include naming instructions in V0 prompts to ensure new components follow your project conventions
  • Add barrel exports (index.ts) to feature directories for cleaner import paths
  • Review component names before exporting to GitHub — clean names make the repository more professional

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

My V0 project has 20+ components with generic names like Card1, HeroSection2, and MyComponent. How do I systematically rename them and reorganize the file structure without breaking imports?

Frequently asked questions

How do I rename a V0-generated component without breaking the app?

Rename the file in the V0 file explorer, update the component name and export inside the file, then use global search (Shift+Cmd+F) to find and update all import statements that reference the old name. Save all changed files.

Should I rename shadcn/ui components in /components/ui?

No. Keep shadcn/ui components with their standard names (button.tsx, card.tsx, dialog.tsx) in /components/ui. Other tools like the shadcn CLI expect these exact paths and names. Only rename your custom components.

What naming convention should I use for V0 component files?

Use kebab-case for file names (pricing-card.tsx) and PascalCase for component names (PricingCard). This follows Next.js and React community conventions and is consistent with shadcn/ui's naming pattern.

Can V0 automatically rename components when I ask it to?

Yes. Prompt V0 with specific renaming instructions like 'Rename Card1 to PricingCard and move it from /components to /components/marketing/pricing-card.tsx. Update all imports.' V0 will make the changes and update references.

How do I organize a V0 project with many components?

Group components by feature: /components/marketing for landing pages, /components/auth for login and signup, /components/dashboard for app features. Keep shared UI components in /components/ui. This structure scales well as the project grows.

Can RapidDev help restructure a large V0 project?

Yes. RapidDev can audit your V0 project structure, rename components to follow conventions, organize files into feature directories, and ensure all imports resolve correctly after the reorganization.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your issue.

Book a free consultation

Need help with your Lovable project?

Our experts have built 600+ apps and can solve your issue fast. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.