typescriptadvanced
Parallel Routes Layout
Next.js parallel routes pattern to render multiple page slots simultaneously in a shared layout.
typescriptPress ⌘/Ctrl + Shift + C to copy
// app/dashboard/layout.tsx
// Parallel routes use @folder convention for named slots
export default function DashboardLayout({
children,
analytics,
notifications,
}: {
children: React.ReactNode;
analytics: React.ReactNode;
notifications: React.ReactNode;
}) {
return (
<div className="grid grid-cols-12 gap-6 p-6">
{/* Main content */}
<div className="col-span-8">{children}</div>
{/* Sidebar with parallel slots */}
<div className="col-span-4 space-y-6">
{analytics}
{notifications}
</div>
</div>
);
}
// File structure:
// app/dashboard/
// layout.tsx <- this file
// page.tsx <- renders in {children}
// @analytics/
// page.tsx <- renders in {analytics}
// loading.tsx <- independent loading state
// @notifications/
// page.tsx <- renders in {notifications}
// loading.tsx <- independent loading state
//
// Each slot loads independently with its own loading/error states.
// Navigation preserves all slots — no full page reload.Sponsored
Vercel — Deploy Next.js with zero config
Use Cases
- Dashboard multi-panel layouts
- Side-by-side views
- Independent loading states
Tags
Related Snippets
Similar patterns you can reuse in the same workflow.
typescriptadvanced
Next.js Parallel Routes Layout
Use parallel routes with named slots to render multiple pages simultaneously in a layout.
Best for: Dashboard layouts with independent loading states
#nextjs#routing
typescriptintermediate
Route Groups for Layout Organization
Use route groups to share layouts across routes without affecting URL structure.
Best for: Marketing vs. dashboard layouts
#nextjs#routing
typescriptadvanced
Intercepting Routes Modal
Show content in a modal on soft navigation while preserving the full page on hard navigation.
Best for: Photo gallery modals
#routing#modals
typescriptadvanced
Next.js Intercepting Routes for Modals
Implement modal patterns with intercepting routes that work with both soft and hard navigation.
Best for: Image gallery modals with shareable URLs
#nextjs#routing