Page Layout Builder
Generate production-ready page layouts with routing, navigation, and state patterns.
Core Workflow Choose page type: Dashboard, auth, settings, CRUD, landing, etc. Setup routing: Create route files with proper structure Build layout: Header, sidebar, main content, footer Add navigation: Nav menus, breadcrumbs, tabs State placeholders: Data fetching, forms, modals Responsive design: Mobile-first with breakpoints Loading states: Skeletons and suspense boundaries Common Page Patterns Dashboard Layout // app/dashboard/layout.tsx import { Sidebar } from "@/components/Sidebar"; import { Header } from "@/components/Header";
export default function DashboardLayout({ children, }: { children: React.ReactNode; }) { return (
{/* Main Content Area */}
<div className="flex flex-1 flex-col overflow-hidden">
{/* Header */}
<Header />
{/* Page Content */}
<main className="flex-1 overflow-y-auto p-4 md:p-6 lg:p-8">
{children}
</main>
</div>
</div>
); }
// app/dashboard/page.tsx import { StatsCard } from "@/components/dashboard/StatsCard"; import { RecentActivity } from "@/components/dashboard/RecentActivity"; import { Chart } from "@/components/dashboard/Chart";
export default function DashboardPage() { return (
Dashboard
Welcome back! Here's your overview.
{/* Stats Grid */}
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
<StatsCard title="Total Users" value="2,543" change="+12%" trend="up" />
<StatsCard title="Revenue" value="$45,231" change="+8%" trend="up" />
<StatsCard
title="Active Sessions"
value="431"
change="-3%"
trend="down"
/>
<StatsCard
title="Conversion Rate"
value="3.2%"
change="+0.5%"
trend="up"
/>
</div>
{/* Charts and Activity */}
<div className="grid gap-6 md:grid-cols-2">
<Chart title="Revenue Over Time" />
<RecentActivity title="Recent Activity" />
</div>
</div>
); }
Authentication Pages // app/(auth)/layout.tsx export default function AuthLayout({ children, }: { children: React.ReactNode; }) { return (
Welcome to AppName
The best platform for managing your workflow
{/* Right side - Auth form */}
<div className="flex flex-1 flex-col justify-center px-4 py-12 sm:px-6 lg:px-20 xl:px-24">
<div className="mx-auto w-full max-w-sm">{children}</div>
</div>
</div>
); }
// app/(auth)/login/page.tsx "use client";
import { useState } from "react"; import { useRouter } from "next/navigation"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import Link from "next/link";
export default function LoginPage() { const router = useRouter(); const [isLoading, setIsLoading] = useState(false);
const handleSubmit = async (e: React.FormEvent
// TODO: Implement authentication logic
try {
// await signIn(formData);
router.push("/dashboard");
} catch (error) {
console.error("Login failed:", error);
} finally {
setIsLoading(false);
}
};
return (
Sign In
Enter your credentials to access your account
<form onSubmit={handleSubmit} className="space-y-4">
<div className="space-y-2">
<Label htmlFor="email">Email</Label>
<Input
id="email"
type="email"
placeholder="you@example.com"
required
/>
</div>
<div className="space-y-2">
<div className="flex items-center justify-between">
<Label htmlFor="password">Password</Label>
<Link
href="/forgot-password"
className="text-sm text-primary-600 hover:underline"
>
Forgot password?
</Link>
</div>
<Input
id="password"
type="password"
placeholder="••••••••"
required
/>
</div>
<Button type="submit" className="w-full" isLoading={isLoading}>
Sign In
</Button>
</form>
<div className="text-center text-sm">
Don't have an account?{" "}
<Link href="/register" className="text-primary-600 hover:underline">
Sign up
</Link>
</div>
</div>
); }
Settings/Profile Page // app/settings/layout.tsx import { SettingsSidebar } from "@/components/settings/SettingsSidebar";
export default function SettingsLayout({ children, }: { children: React.ReactNode; }) { return (
Settings
Manage your account settings and preferences
<div className="flex flex-col gap-6 lg:flex-row">
<SettingsSidebar className="lg:w-64" />
<div className="flex-1">{children}</div>
</div>
</div>
); }
// app/settings/profile/page.tsx "use client";
import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Card } from "@/components/ui/card";
export default function ProfileSettingsPage() { const [isSaving, setIsSaving] = useState(false);
const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsSaving(true);
// TODO: Save profile changes
setIsSaving(false);
};
return (