Parallel Routes and default.js

A folder whose name starts with @ is a slot. It is not a URL segment; it is an extra prop delivered to its parent's layout, holding a subtree the router matched independently of children. Slots let one layout render several routes at once, each navigating on its own — dashboards, feeds, tab groups.

app/dashboard/layout.jsJavaScript
import Link from 'next/link'
export default function DashboardLayout({ children, team, analytics }) {
  return (
    <section>
      <h1>Dashboard</h1>
      <Link href="/dashboard/settings">Settings</Link>
      <div>{children}</div>
      <aside>{team}</aside><aside>{analytics}</aside>
    </section>
  )
}

children is itself an implicit slot. Because slots are invisible to the URL, app/dashboard/@team/settings/page.js and app/dashboard/settings/page.js both belong to the single route /dashboard/settings.

That raises the question the feature turns on: what does a slot show when the URL has nothing for it? On a client-side navigation Next.js 10,514 keeps each slot's previous state; on a hard load it cannot, and renders that slot's default.js. The demo has @team/settings but no @analytics/settings, so one URL yields two results:

Output of 11
hard load of /dashboard/settings
  <section><h1>Dashboard</h1><a href="/dashboard/settings">Settings</a>
  <div><p>Account settings</p></div><aside><p>Team roles</p></aside>
  <aside><p>Analytics unavailable on this route</p></aside></section>
click on the Settings link from /dashboard
  ... <aside><p>Team roles</p></aside>
  <aside><p>Analytics: 1,204 views</p></aside></section>

Since Next.js 16 a named slot without a default.js is a build error, not a silent 404: the build stops with "Missing required default.js file for parallel route at /dashboard/@analytics". Returning null from it hides the slot, calling notFound() restores the old behavior, and rendering the slot's normal content — as @analytics does here — makes the refreshed page match the navigated one. In a Client Component, useSelectedLayoutSegment('analytics') reports which subpage a slot is showing, which is how tabs are highlighted. Every slot renders on the server even when the layout drops one: a layout that picks admin over user by role still runs the admin queries, so authorize inside each slot.