← All topics

Parallel & intercepting routes

Render several pages in one layout via @slots, and intercept a navigation to show it in context (modals).

  • @activity and @modal are slots: the parent layout receives them as props next to children.
  • Each slot needs a default.tsx for hard navigations where it has no match.
  • (.)tasks/[taskId] intercepts /tasks/[taskId] on soft navigation, showing a modal.
  • Reloading or sharing the URL renders the full standalone page instead, so every modal is deep-linkable.

See it in this app: src/app/(app)/projects/[id]/@modal and @activity

// layout receives slots as props
export default function Layout({ children, modal, activity }: Props) {
  return (<>{children}{activity}{modal}</>);
}