/v0-generate--form--accessible"User registration form with email, password, and terms acceptance"
Command Content (6)
Additional code example for this command.
v0-generate.ts
typescript
// components/forms/registration-form.tsx'use client';import{useState}from'react';import{useForm}from'react-hook-form';import{zodResolver}from'@hookform/resolvers/zod';import*aszfrom'zod';import{Button}from'@/components/ui/button';import{Form,FormControl,FormDescription,FormField,FormItem,FormLabel,FormMessage,}from'@/components/ui/form';import{Input}from'@/components/ui/input';import{Checkbox}from'@/components/ui/checkbox';import{Loader2}from'lucide-react';constformSchema=z.object({email:z.string().email({message:'Please enter a valid email address'}).min(1,{message:'Email is required'}),password:z.string().min(8,{message:'Password must be at least 8 characters'}).regex(/[A-Z]/,{message:'Password must contain at least one uppercase letter'}).regex(/[a-z]/,{message:'Password must contain at least one lowercase letter'}).regex(/[0-9]/,{message:'Password must contain at least one number'}),confirmPassword:z.string(),acceptTerms:z.boolean().refine((val)=>val===true,{message:'You must accept the terms and conditions',}),}).refine((data)=>data.password===data.confirmPassword,{message:"Passwords don't match",path:['confirmPassword'],});typeFormValues=z.infer<typeofformSchema>;interface RegistrationFormProps {onSubmit:(data:FormValues)=>Promise<void>;}export function RegistrationForm({onSubmit}: RegistrationFormProps) {const[isSubmitting,setIsSubmitting]=useState(false);constform=useForm<FormValues>({resolver:zodResolver(formSchema),defaultValues:{email:'',password:'',confirmPassword:'',acceptTerms:false,},}); const handleSubmit = async (data: FormValues) =>{setIsSubmitting(true);try{awaitonSubmit(data);} finally {setIsSubmitting(false);}}; return (<Form{...form}><formonSubmit={form.handleSubmit(handleSubmit)}className="space-y-6"><FormFieldcontrol={form.control}name="email"render={({field})=>(<FormItem><FormLabel>Email</FormLabel><FormControl><Inputtype="email"placeholder="you@example.com"autoComplete="email"{...field}/></FormControl><FormMessage/></FormItem>)}/><FormFieldcontrol={form.control}name="password"render={({field})=>(<FormItem><FormLabel>Password</FormLabel><FormControl><Inputtype="password"placeholder="••••••••"autoComplete="new-password"{...field}/></FormControl><FormDescription> Must be at least 8 characters with uppercase, lowercase, and number</FormDescription><FormMessage/></FormItem>)}/><FormFieldcontrol={form.control}name="confirmPassword"render={({field})=>(<FormItem><FormLabel>Confirm Password</FormLabel><FormControl><Inputtype="password"placeholder="••••••••"autoComplete="new-password"{...field}/></FormControl><FormMessage/></FormItem>)}/><FormFieldcontrol={form.control}name="acceptTerms"render={({field})=>(<FormItemclassName="flex flex-row items-start space-x-3 space-y-0"><FormControl><Checkboxchecked={field.value}onCheckedChange={field.onChange}/></FormControl><divclassName="space-y-1 leading-none"><FormLabel> I accept the{''}<ahref="/terms"className="underline hover:text-primary"> terms and conditions</a></FormLabel><FormMessage/></div></FormItem>)}/><Buttontype="submit"className="w-full"disabled={isSubmitting}>{isSubmitting&&<Loader2className="mr-2 h-4 w-4 animate-spin"/>} Create Account</Button></form></Form>);}
Command Content (7)
Additional code example for this command.
v0-generate.txt
/v0-generate--landing--animated"Hero section with gradient background, CTA buttons, and feature highlights"
Command Content (8)
Additional code example for this command.
v0-generate.ts
typescript
// components/landing/hero-section.tsx'use client';import{motion}from'framer-motion';import{Button}from'@/components/ui/button';import{ArrowRight,Zap,Shield,Rocket}from'lucide-react';constcontainerVariants={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:0.2,},},};constitemVariants={hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:0.5},},};exportfunctionHeroSection(){return(<sectionclassName="relative overflow-hidden bg-gradient-to-b from-primary/5 via-background to-background"><divclassName="container relative z-10 px-4 py-24 md:py-32"><motion.divvariants={containerVariants}initial="hidden"animate="visible"className="mx-auto max-w-4xl text-center"><motion.divvariants={itemVariants}><h1className="text-4xl font-bold tracking-tight sm:text-6xl"> Build Modern Apps{''}<spanclassName="bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent"> 10x Faster</span></h1></motion.div><motion.pvariants={itemVariants}className="mt-6 text-lg text-muted-foreground sm:text-xl"> Ship production-ready applications with the power of Next.js 15, React 19, and cutting-edge AI tools. Start building today.</motion.p><motion.divvariants={itemVariants}className="mt-10 flex flex-col gap-4 sm:flex-row sm:justify-center"><Buttonsize="lg"className="group"> Get Started Free<ArrowRightclassName="ml-2 h-4 w-4 transition-transform group-hover:translate-x-1"/></Button><Buttonsize="lg"variant="outline"> View Demo</Button></motion.div><motion.divvariants={containerVariants}className="mt-20 grid gap-8 sm:grid-cols-3"><motion.divvariants={itemVariants}className="flex flex-col items-center"><divclassName="flex h-12 w-12 items-center justify-center rounded-lg bg-primary/10"><ZapclassName="h-6 w-6 text-primary"/></div><h3className="mt-4 text-lg font-semibold">Lightning Fast</h3><pclassName="mt-2 text-sm text-muted-foreground"> Optimized performance with sub-second load times</p></motion.div><motion.divvariants={itemVariants}className="flex flex-col items-center"><divclassName="flex h-12 w-12 items-center justify-center rounded-lg bg-primary/10"><ShieldclassName="h-6 w-6 text-primary"/></div><h3className="mt-4 text-lg font-semibold">Secure by Default</h3><pclassName="mt-2 text-sm text-muted-foreground"> Built-in security best practices and compliance</p></motion.div><motion.divvariants={itemVariants}className="flex flex-col items-center"><divclassName="flex h-12 w-12 items-center justify-center rounded-lg bg-primary/10"><RocketclassName="h-6 w-6 text-primary"/></div><h3className="mt-4 text-lg font-semibold">Deploy Instantly</h3><pclassName="mt-2 text-sm text-muted-foreground"> One-click deployment to global edge network</p></motion.div></motion.div></motion.div></div>{/* Background gradient orbs */}<divclassName="absolute inset-0 -z-10 overflow-hidden"><divclassName="absolute -top-40 -right-40 h-80 w-80 rounded-full bg-primary/20 blur-3xl"/><divclassName="absolute -bottom-40 -left-40 h-80 w-80 rounded-full bg-primary/20 blur-3xl"/></div></section>);}
Production-ready React component generation with V0.dev AI patterns using natural language descriptions to create fully functional components
shadcn/ui integration with automatic component import and usage following shadcn/ui best practices and default implementations for optimal AI generation
Multi-framework support for Next.js 15 App Router, React 19 standalone, Remix, and Astro with framework-specific optimizations and patterns
Advanced styling options with TailwindCSS v4, CSS Modules, Styled Components, and Vanilla Extract with responsive mobile-first design by default
Accessibility and performance features with WCAG 2.2 Level AA compliance, dark mode support, framer-motion animations, and Server/Client Component optimization
Component type generation for pages, reusable components, forms with validation, dashboard layouts, and landing page sections with appropriate patterns
TypeScript and validation support with full TypeScript types, Zod schema validation for forms, and proper type safety throughout generated components
Use Cases
Common scenarios and applications
Dashboard page generation - Create analytics dashboards with revenue charts, user stats cards, activity tables, and responsive layouts using shadcn/ui components
Form component generation - Generate accessible registration forms, login forms, and data entry forms with Zod validation, error handling, and WCAG compliance
Landing page sections - Create hero sections with gradient backgrounds, CTA buttons, feature highlights, and animated framer-motion transitions
Reusable component library - Generate reusable React components following shadcn/ui patterns for consistent design system integration
Next.js 15 App Router pages - Create Server Components and Client Components with proper use client directives and React 19 compatibility
Dark mode UI components - Generate components with built-in dark mode support using next-themes and CSS variables for seamless theme switching
Accessible interactive components - Create WCAG 2.2 Level AA compliant components with proper ARIA labels, keyboard navigation, and screen reader support
Requirements
Prerequisites and dependencies
Create .claude/commands/ directory in project root (mkdir -p .claude/commands) for project commands or ~/.claude/commands/ for personal commands
Create v0-generate.md file in .claude/commands/ directory with command instructions
Claude Code CLI installed with React and Next.js support for component generation workflows
Next.js 15+ or React 19+ project initialized with TypeScript configuration for component development
shadcn/ui installed and configured with components.json file in project root for component library integration
TailwindCSS v4 installed and configured with tailwind.config.ts and globals.css for styling support
Optional: framer-motion installed for animation support (npm install framer-motion or pnpm add framer-motion)
Optional: react-hook-form and zod installed for form validation (npm install react-hook-form zod @hookform/resolvers or pnpm add react-hook-form zod @hookform/resolvers)
Usage Examples
Practical code examples demonstrating common use cases and implementation patterns
Generate dashboard page with analytics
Generate complete dashboard page with shadcn/ui cards, charts, tables, and dark mode support using Next.js 15 App Router
generate-dashboard-page-with-analytics.txt
plaintext
/v0-generate--page--dashboard--dark-mode"Analytics dashboard with revenue chart, user stats cards, and recent activity table"
Generate accessible registration form
Create WCAG 2.2 compliant form with Zod validation, error handling, and proper ARIA labels using react-hook-form and shadcn/ui form components
generate-accessible-registration-form.txt
plaintext
/v0-generate--form--accessible"User registration form with email, password, and terms acceptance"
Generate animated hero section
Create landing page hero section with framer-motion animations, gradient backgrounds, and responsive design using TailwindCSS v4
generate-animated-hero-section.txt
plaintext
/v0-generate--landing--animated"Hero section with gradient background, CTA buttons, and feature highlights"
Generate Next.js 15 Server Component
Generate React Server Component for Next.js 15 App Router with proper TypeScript types and shadcn/ui Card components
generate-next-js-15-server-component.txt
plaintext
/v0-generate--component--next15--server-component"User profile card component with avatar and bio"
Generate form with custom validation
Create form component with Zod schema validation, custom error messages, and shadcn/ui Form components with TailwindCSS styling
generate-form-with-custom-validation.txt
plaintext
/v0-generate--form--shadcn--tailwind"Contact form with name, email, message fields and custom validation rules"
Generate Remix component
Generate Remix-compatible component with proper loader and action patterns, shadcn/ui integration, and TypeScript support
generate-remix-component.txt
plaintext
/v0-generate--component--remix"Product card component with image, title, price, and add to cart button"
Generate responsive dashboard layout
Create responsive dashboard layout with mobile-first design, dark mode support, and shadcn/ui navigation components
generate-responsive-dashboard-layout.txt
plaintext
/v0-generate--dashboard--responsive--dark-mode"Admin dashboard with sidebar navigation, header, and main content area"
Troubleshooting
Common issues and solutions
shadcn/ui installation fails with React 19 peer dependency conflict
Use npm install --legacy-peer-deps or pnpm add with --force flag. Update to shadcn/ui canary for React 19 support. Override react-is dependency.
Generated components show TypeScript errors with Next.js 15 types
Update @types/react and @types/react-dom to latest. Set typescript: strict: false temporarily. Verify Next.js 15.5+ with React 19.1 compatibility.
Generated component missing proper 'use client' directives or RSC errors
Add 'use client' to interactive components manually. Verify hooks usage requires client directive. Check Server Component vs Client Component architecture.
TailwindCSS v4 classes not applying to generated shadcn components
Verify tailwind.config.ts includes component paths in content array. Run npx tailwindcss init to regenerate config. Check @import rules in globals.css.
Framer Motion animations causing hydration errors in Next.js 15
Wrap animated components with 'use client' directive at file top. Use LazyMotion for reduced bundle size. Check MotionConfig compatibility with React 19.