Parallel routes with @ slots: independent route trees passed to a layout as props.
Parallel routes let you render multiple pages in the same view at once. A folder prefixed with @ defines a slot: a named subtree that resolves independently of the main route tree and does not add a segment to the URL.
<Layout team="…" analytics="…">
{children}
</Layout>
A team = @team slot
B analytics = @analytics slotThe slot is passed as a prop to the layout.tsx in the same directory as the @slot folder. The prop name is the slot name (without the @). The layout decides where the slot appears.
| Folder | Creates URL? | How it renders |
|---|---|---|
| @team | No - slot only | Passed to layout as the `team` prop |
| @team/page.tsx | Yes - via parent / | Renders inside the parent layout |
| @analytics/page.tsx | Yes - via parent / | Renders at the same time as the main page |
layout.tsx in the same directory is an error. The layout must read the slot as a prop or the build fails.Slots use the @folder convention. The tree below defines two slots: @analytics and @team, both at the app/ root.
The layout.tsx receives both slots as props named after the folders:
Routes inside a slot support the same patterns as the main tree: dynamic segments [id], catch-alls [...slug], nested layouts. Slot pages do not support data exports (loader, action, ErrorBoundary); they are silently ignored.
When no route inside a slot matches the current URL, the slot renders its default.tsx (if present), or a built-in empty fallback.
Example: @team/settings/page.tsx exists, but @analytics has no /settings route. Navigating to /settings renders the @team settings page plus @analytics/default.tsx.
Bini.js is a pure SPA with BrowserRouter. Matching order: static first, then dynamic :param, then required catch-alls *, then optional catch-alls **. Within each category, shorter paths win.
| Current URL | @team | @analytics | Renders |
|---|---|---|---|
| / | page.tsx | page.tsx | Main page + both slots |
| /settings | settings/page.tsx | default.tsx | @team settings + @analytics default |
| /unknown | no match | no match | Both slots render their default.tsx |
loader, action, ErrorBoundary, and the rest) are ignored. Slot pages are pure UI.Put a layout.tsx in the parent folder (same directory as the @slot), not inside the slot, to share UI across the slot's routes.
The parent layout.tsx receives the analytics slot as a prop. The slot itself contains both routes. If you want a tab bar to persist across the slot's routes, render the tab UI inside the slot's own layout, or wrap the routes in a shared component.
Each slot can define its own loading.tsx and error.tsx. They use nearest-wins and are code-split with React.lazy. In the diagram: A = loading for @team, B = error for @analytics, C = loading for @analytics.
The loading file is the Suspense fallback. Error boundaries reset when the pathname changes. The built-in fallback renders nothing in development and a generic retry UI in production.
A full example: two slots at the root, a layout that receives both as props, and the main page.
<Layout team="…" analytics="…">
{children}
</Layout>
A team = @team slot
B analytics = @analytics slot| Path | URL | Support |
|---|---|---|
| src/app/page.tsx | / | Main tree |
| src/app/@analytics/page.tsx | / | Slot, passed as `analytics` prop |
| src/app/@team/page.tsx | / | Slot, passed as `team` prop |
| src/app/@analytics/default.tsx | - | Fallback for the slot |
| src/app/@analytics/page-views/page.tsx | /page-views | Slot sub-route |
| src/app/_components/Header.tsx | - | Ignored (_ prefix) |
Match URL segments with dynamic parameters and catch-alls.
Match any number of trailing URL segments.
Render alternative content when navigating from within the app.
Create your first pages and wrap them in shared layouts.
Catch render errors and show a fallback UI.
Show a fallback while pages and layouts load.
Parallel routes with @ slots: independent route trees passed to a layout as props.
Parallel routes let you render multiple pages in the same view at once. A folder prefixed with @ defines a slot: a named subtree that resolves independently of the main route tree and does not add a segment to the URL.
<Layout team="…" analytics="…">
{children}
</Layout>
A team = @team slot
B analytics = @analytics slotThe slot is passed as a prop to the layout.tsx in the same directory as the @slot folder. The prop name is the slot name (without the @). The layout decides where the slot appears.
| Folder | Creates URL? | How it renders |
|---|---|---|
| @team | No - slot only | Passed to layout as the `team` prop |
| @team/page.tsx | Yes - via parent / | Renders inside the parent layout |
| @analytics/page.tsx | Yes - via parent / | Renders at the same time as the main page |
layout.tsx in the same directory is an error. The layout must read the slot as a prop or the build fails.Slots use the @folder convention. The tree below defines two slots: @analytics and @team, both at the app/ root.
The layout.tsx receives both slots as props named after the folders:
Routes inside a slot support the same patterns as the main tree: dynamic segments [id], catch-alls [...slug], nested layouts. Slot pages do not support data exports (loader, action, ErrorBoundary); they are silently ignored.
When no route inside a slot matches the current URL, the slot renders its default.tsx (if present), or a built-in empty fallback.
Example: @team/settings/page.tsx exists, but @analytics has no /settings route. Navigating to /settings renders the @team settings page plus @analytics/default.tsx.
Bini.js is a pure SPA with BrowserRouter. Matching order: static first, then dynamic :param, then required catch-alls *, then optional catch-alls **. Within each category, shorter paths win.
| Current URL | @team | @analytics | Renders |
|---|---|---|---|
| / | page.tsx | page.tsx | Main page + both slots |
| /settings | settings/page.tsx | default.tsx | @team settings + @analytics default |
| /unknown | no match | no match | Both slots render their default.tsx |
loader, action, ErrorBoundary, and the rest) are ignored. Slot pages are pure UI.Put a layout.tsx in the parent folder (same directory as the @slot), not inside the slot, to share UI across the slot's routes.
The parent layout.tsx receives the analytics slot as a prop. The slot itself contains both routes. If you want a tab bar to persist across the slot's routes, render the tab UI inside the slot's own layout, or wrap the routes in a shared component.
Each slot can define its own loading.tsx and error.tsx. They use nearest-wins and are code-split with React.lazy. In the diagram: A = loading for @team, B = error for @analytics, C = loading for @analytics.
The loading file is the Suspense fallback. Error boundaries reset when the pathname changes. The built-in fallback renders nothing in development and a generic retry UI in production.
A full example: two slots at the root, a layout that receives both as props, and the main page.
<Layout team="…" analytics="…">
{children}
</Layout>
A team = @team slot
B analytics = @analytics slot| Path | URL | Support |
|---|---|---|
| src/app/page.tsx | / | Main tree |
| src/app/@analytics/page.tsx | / | Slot, passed as `analytics` prop |
| src/app/@team/page.tsx | / | Slot, passed as `team` prop |
| src/app/@analytics/default.tsx | - | Fallback for the slot |
| src/app/@analytics/page-views/page.tsx | /page-views | Slot sub-route |
| src/app/_components/Header.tsx | - | Ignored (_ prefix) |
Match URL segments with dynamic parameters and catch-alls.
Match any number of trailing URL segments.
Render alternative content when navigating from within the app.
Create your first pages and wrap them in shared layouts.
Catch render errors and show a fallback UI.
Show a fallback while pages and layouts load.