Handling Next.js Parallel Routes and Intercepting Routes
Learn how to build complex dashboard layouts and modals in Next.js using parallel and intercepting routes without breaking state.
Summarize this Blog with AI
On this page
Building complex web applications often requires rendering multiple pages simultaneously within the same layout, or opening context-sensitive modals that maintain a shareable URL. In the Next.js App Router, parallel routes and intercepting routes solve these exact architectural problems. Mastering how to combine them allows you to create sophisticated dashboard layouts and contextual overlays without resorting to global state hacks.
Structuring Parallel Routes for Complex Layouts
Parallel routes let you render multiple pages simultaneously in the same layout using named slots. Slots are not routes themselves; they are passed as props to the shared parent layout. This pattern gives you independent error and loading states for each section of a dashboard or split-screen interface.
To create a slot, prefix a folder name with an at-symbol. For instance, a dashboard layout with a user analytics feed and a team activity stream might use this directory structure:
app/dashboard/layout.js
app/dashboard/page.js
app/dashboard/@analytics/page.js
app/dashboard/@team/page.jsIn your layout component, accept these slots as props alongside the standard children prop. Next.js automatically resolves each slot and renders it concurrently. If a user navigates to a sub-route within a slot, Next.js handles soft navigations while preserving the state of sibling slots.
Loading Contextual Modals with Intercepting Routes
Intercepting routes allow you to load a route from another part of the application within the current layout. This is most commonly used when opening a photo detail view or form modal from a gallery page while keeping the background context intact and updating the URL.
Interception uses special file system conventions that mirror relative path notation:
(.)matches segments at the same level.(..)matches segments one level above.(...%)matches segments from the root app directory.
When a user clicks a photo card on a feed, the URL updates to the photo page, but the photo component renders inside a modal slot of the feed layout instead of replacing the entire view. If the user refreshes the page or shares the direct URL, Next.js renders the full non-intercepted page component instead of just the modal.
Managing Fallbacks and Missing Routes
A common pitfall when combining parallel and intercepting routes is handling page reloads or direct URL access for unmatched slots. When a user lands directly on an intercepted route, Next.js looks for a default.js file inside the unmatched parallel route slot to determine what to render.
Always provide a default.js file in every parallel route slot. If you omit this file, hard refreshing a page that displays an active intercepting modal will result in a 404 error because Next.js cannot determine what to render for the sibling slots that lack a corresponding URL segment.
Implementation Checklist
Use this sequence to verify your routing implementation before pushing to production:
- Verify that every parallel route folder contains a valid
default.jsfallback file to prevent hard-refresh 404 errors. - Check that your layout component accepts all slot props explicitly and passes them down to the container elements.
- Test direct URL entry for intercepted routes to ensure the standalone page view renders correctly.
- Confirm that browser back and forward buttons close modals and restore previous slot states accurately.
Frequently asked questions

Dipen Nagani
Senior UI/UX Designer
As a User Experience Designer at Seven Square®, I contribute to enhancing digital experiences by leveraging my skills in UI/UX, CSS, and GSAP. My focus is on creating intuitive and visually engaging user interfaces that align with user needs and business goals.



