--- name: mockup-creation description: Create interactive, production-ready UI mockups and prototypes using NuxtJS 4 (Vue) or Next.js (React), TypeScript, and TailwindCSS v4. Use when building web mockups, prototypes, landing pages, dashboards, admin panels, or interactive UI demonstrations. Trigger when users mention "create mockup", "build prototype", "interactive demo", "UI prototype", "design to code", or need rapid frontend development with modern tooling. Prefer NuxtJS for Vue-based projects; use Next.js when users mention ReactJS. license: MIT compatibility: Requires Node.js 20.x or newer --- # Mockup Creation Create polished, interactive UI mockups and prototypes using NuxtJS 4 (Vue) or Next.js (React) with TypeScript and TailwindCSS v4. ## Overview Rapid creation of production-quality mockups with: **NuxtJS 4 (Vue):** - **Vue 3 Composition API** with TypeScript - **Vite** bundler (built-in) - **Auto-imports** for components and composables - **Zero-config TypeScript** with auto-generated types - **File-based routing** from pages/ directory **Next.js (React):** - **React 19** with TypeScript v5.1.0+ - **Turbopack** bundler (default, faster than Webpack) - **App Router** with Server/Client Components - **Built-in TypeScript** with zero configuration - **File-based routing** from app/ directory **Common Features:** - **TailwindCSS v4** with modern tooling - **Component-driven architecture** - **Server-side rendering (SSR)** or static site generation (SSG) - **Interactive reactivity** - **Production-ready optimizations** ## Quick Start ### Option A: NuxtJS 4 (Vue-based) ### Option A: NuxtJS 4 (Vue-based) #### 1. Initialize Project ```bash # Create NuxtJS 4 project (TypeScript enabled by default) npx nuxi@latest init my-mockup cd my-mockup npm install ``` #### 2. Install and Configure TailwindCSS **Install TailwindCSS v4 with Vite plugin:** ```bash npm install -D tailwindcss @tailwindcss/vite ``` **Configure nuxt.config.ts:** ```typescript // https://nuxt.com/docs/4.x/api/configuration/nuxt-config import tailwindcss from '@tailwindcss/vite' export default defineNuxtConfig({ devtools: { enabled: true }, typescript: { strict: true, typeCheck: true }, // Auto-import components and composables components: [ { path: '~/components', pathPrefix: false, }, ], // App configuration app: { head: { charset: 'utf-8', viewport: 'width=device-width, initial-scale=1', title: 'My Mockup', meta: [ { name: 'description', content: 'My mockup description' } ], } }, // Vite configuration with TailwindCSS v4 vite: { plugins: [ tailwindcss() ], css: { devSourcemap: true } } }) ``` **Create CSS file and import TailwindCSS (e.g., assets/css/main.css):** ```css @import "tailwindcss"; ``` **Import CSS in app.vue or nuxt.config.ts:** ```typescript // In nuxt.config.ts, add to the config: export default defineNuxtConfig({ css: ['~/assets/css/main.css'], // ... rest of config }) ``` #### 3. Start Development ```bash npm run dev # Opens http://localhost:3000 ``` ### Option B: Next.js (React-based) #### 1. Initialize Project ```bash # Create Next.js project (uses recommended defaults with TypeScript and TailwindCSS) npx create-next-app@latest my-mockup --yes cd my-mockup ``` **Or with custom options:** ```bash npx create-next-app@latest my-mockup # Choose: TypeScript: Yes, TailwindCSS: Yes, App Router: Yes ``` #### 2. Verify TailwindCSS v4 Setup **Next.js includes TailwindCSS by default. To upgrade to v4:** ```bash npm install -D tailwindcss@next @tailwindcss/postcss@next ``` **Update tailwind.config.ts:** ```typescript import type { Config } from 'tailwindcss' export default { content: [ './app/**/*.{js,ts,jsx,tsx,mdx}', './components/**/*.{js,ts,jsx,tsx,mdx}', ], } satisfies Config ``` **Update postcss.config.mjs:** ```javascript export default { plugins: { '@tailwindcss/postcss': {}, }, } ``` **Update app/globals.css:** ```css @import "tailwindcss"; ``` #### 3. Start Development ```bash npm run dev # Opens http://localhost:3000 ``` ## Workflow ### 1. Define Structure Identify mockup requirements: - Layout type (single page, dashboard, multi-page) - Sections needed (header, hero, features, footer, sidebar) - Responsive breakpoints (mobile, tablet, desktop) - Interactive elements (forms, modals, dropdowns) ### 2. Create Component Architecture **NuxtJS (Vue) auto-imports from:** ``` my-mockup/ ├── components/ │ ├── layout/ # Header, Footer, Sidebar (auto-imported) │ ├── ui/ # Button, Card, Modal, Input (auto-imported) │ └── sections/ # Hero, Features, Testimonials (auto-imported) ├── pages/ # File-based routing (auto-routed) ├── composables/ # Shared logic (auto-imported) ├── layouts/ # Layout templates (default.vue, dashboard.vue) └── types/ # TypeScript interfaces ``` **Next.js (React) structure:** ``` my-mockup/ ├── app/ │ ├── layout.tsx # Root layout (required) │ ├── page.tsx # Home page │ ├── dashboard/ │ │ └── page.tsx # /dashboard route │ └── globals.css # TailwindCSS imports ├── components/ │ ├── layout/ # Header, Footer, Sidebar │ ├── ui/ # Button, Card, Modal, Input │ └── sections/ # Hero, Features, Testimonials ├── lib/ # Utilities and shared logic └── types/ # TypeScript interfaces ``` ### 3. Build Components **NuxtJS (Vue) Example: Type-safe Button Component (components/ui/Button.vue)** ```vue ``` **Usage in pages/index.vue:** ```vue ``` **Next.js (React) Example: Type-safe Button Component (components/ui/Button.tsx)** ```typescript import { ButtonHTMLAttributes } from 'react' interface ButtonProps extends ButtonHTMLAttributes { variant?: 'primary' | 'secondary' | 'outline' size?: 'sm' | 'md' | 'lg' children: React.ReactNode } export function Button({ variant = 'primary', size = 'md', children, className = '', ...props }: ButtonProps) { const variants = { primary: 'bg-blue-600 text-white hover:bg-blue-700', secondary: 'bg-gray-600 text-white hover:bg-gray-700', outline: 'border-2 border-blue-600 text-blue-600 hover:bg-blue-50' } const sizes = { sm: 'px-3 py-1.5 text-sm', md: 'px-4 py-2 text-base', lg: 'px-6 py-3 text-lg' } const buttonClasses = `font-semibold rounded-lg transition ${variants[variant]} ${sizes[size]} ${className}` return ( ) } ``` **Usage in app/page.tsx:** ```typescript import { Button } from '@/components/ui/Button' export default function Home() { return (
) } ``` ### 4. Apply Responsive Design Use TailwindCSS breakpoints: - `sm:` (640px), `md:` (768px), `lg:` (1024px), `xl:` (1280px), `2xl:` (1536px) **NuxtJS (Vue) Responsive Grid Example:** ```vue ``` **Next.js (React) Responsive Grid Example:** ```typescript import { Card } from '@/components/ui/Card' export default function FeaturesSection() { const items = [ { id: 1, title: 'Feature 1', description: '...' }, // ... ] return (
{items.map((item) => ( ))}
) } ``` ### 5. Add Interactivity **NuxtJS (Vue) Composable Pattern (composables/useModal.ts):** ```typescript // Auto-imported by Nuxt - no need to import 'ref' export function useModal() { const isOpen = ref(false) const open = () => { isOpen.value = true } const close = () => { isOpen.value = false } return { isOpen, open, close } } ``` **Usage in any Vue component:** ```vue ``` **Next.js (React) Custom Hook Pattern (lib/hooks/useModal.ts):** ```typescript import { useState } from 'react' export function useModal() { const [isOpen, setIsOpen] = useState(false) const open = () => setIsOpen(true) const close = () => setIsOpen(false) return { isOpen, open, close } } ``` **Usage in any React component:** ```typescript 'use client' // Mark as Client Component for interactivity import { useModal } from '@/lib/hooks/useModal' export default function MyComponent() { const { isOpen, open, close } = useModal() return (
{isOpen && }
) } ``` ### 6. Build for Production **NuxtJS:** ```bash npm run build # Build for production (.output/) npm run preview # Preview production build npm run generate # Generate static site (SSG) ``` **Next.js:** ```bash npm run build # Build for production (.next/) npm run start # Start production server (SSR) # For static export (SSG), add to next.config.js: # output: 'export' ``` ## Common Patterns ### Landing Page (NuxtJS) **Create layout (layouts/default.vue):** ```vue ``` **Create page (pages/index.vue):** ```vue ``` ### Landing Page (Next.js) **Create layout (app/layout.tsx):** ```typescript import { Header } from '@/components/layout/Header' import { Footer } from '@/components/layout/Footer' import './globals.css' export default function RootLayout({ children, }: { children: React.ReactNode }) { return (
{children}