DocsPluginsShowcaseReleases
npmStar us on GitHub

Getting Started

IntroductionInstallationProject StructureLayouts and PagesLinking and Navigating

Routing

Folder-Based RoutingFile-Based RoutingDynamic RoutesParallel RoutesIntercepting RoutesCatch-All RoutesMDX & Markdown Pages

Special Files

Loading UIError BoundariesTemplateDefaultNot Found

Data Fetching

LoadersActionsAccessing Route Data

Metadata

Metadata & SEOOpen Graph & TwitterIcons & Favicons

API Routes

API Routes OverviewPlain Function HandlersHono IntegrationDynamic API Routes

Environment Variables

OverviewPrefixes & Client ExposureUsing in API Routes

Styling

CSS OverviewTailwind CSSCSS Modules

Platforms

WebWindowsmacOSLinuxAndroidiOS

Deployment

Deployment OverviewProduction ServerStatic ExportHosting Providers

A native React framework for building cross-platform applications from a single codebase.

Resources

  • Documentation
  • Plugins
  • Showcase
  • Releases

Community

  • GitHub Discussions
  • Reddit
  • Discord
  • LinkedIn

More

  • npm
  • GitHub
  • Issues
  • License

© 2026 Bini Cooperation.

Parallel Routes

Experimental

Parallel routes with @ slots: independent route trees passed to a layout as props.

Overview

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.

app
@team
A
page.tsx
@analytics
B
page.tsx
layout.tsx
page.tsx
example.com
A
B
Layout receives slots as props
<Layout team="…" analytics="…">
  {children}
</Layout>

A team = @team slot
B analytics = @analytics slot

The 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.

FolderCreates URL?How it renders
@teamNo - slot onlyPassed to layout as the `team` prop
@team/page.tsxYes - via parent /Renders inside the parent layout
@analytics/page.tsxYes - via parent /Renders at the same time as the main page
A slot without a receiving layout.tsx in the same directory is an error. The layout must read the slot as a prop or the build fails.

Convention: slots

Slots use the @folder convention. The tree below defines two slots: @analytics and @team, both at the app/ root.

app
@analytics
page.tsx
@team
page.tsx
layout.tsx
page.tsx

The layout.tsx receives both slots as props named after the folders:

src/app/layout.tsx
import { Outlet } from 'react-router-dom'

export default function RootLayout({
  team,
  analytics,
}: {
  team: React.ReactNode
  analytics: React.ReactNode
}) {
  return (
    <div className="grid grid-cols-[1fr_1fr] gap-4">
      <main><Outlet /></main>
      <aside>
        {team}
        {analytics}
      </aside>
    </div>
  )
}

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.

src/app/@analytics/page.tsx
// Slot content for / - does not add /@analytics to the URL
export default function AnalyticsSlot() {
  return <div>Analytics for /</div>
}
src/app/@team/page.tsx
export default function TeamSlot() {
  return <div>Team for /</div>
}

default.tsx fallback

When no route inside a slot matches the current URL, the slot renders its default.tsx (if present), or a built-in empty fallback.

app
@team
settings
page.tsx
@analytics
default.tsx
page.tsx
layout.tsx
page.tsx

Example: @team/settings/page.tsx exists, but @analytics has no /settings route. Navigating to /settings renders the @team settings page plus @analytics/default.tsx.

src/app/@analytics/default.tsx
export default function Default() {
  return <div>Select analytics view</div>
}

Behavior in Bini

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@analyticsRenders
/page.tsxpage.tsxMain page + both slots
/settingssettings/page.tsxdefault.tsx@team settings + @analytics default
/unknownno matchno matchBoth slots render their default.tsx
Data exports in slot pages (loader, action, ErrorBoundary, and the rest) are ignored. Slot pages are pure UI.

Tab groups inside slots

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.

app
@analytics
page-views
page.tsx
visitors
page.tsx
layout.tsx
...

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.

Loading and error boundaries

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.

...
@team
page.tsx
error.tsx
A
loading.tsx
@analytics
page.tsx
B
error.tsx
C
loading.tsx
layout.tsx
example.com
A
Loading...
C
Loading...
↓
example.com
B
Error...

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.

src/app/@analytics/loading.tsx
export default function Loading() {
  return <div>Loading analytics...</div>
}
src/app/@team/error.tsx
export default function Error({
  error,
  reset,
}: {
  error: Error
  reset: () => void
}) {
  return (
    <div>
      <h2>Team failed</h2>
      <button onClick={() => reset()}>Retry</button>
    </div>
  )
}

Complete example

A full example: two slots at the root, a layout that receives both as props, and the main page.

app
@team
A
page.tsx
@analytics
B
page.tsx
layout.tsx
page.tsx
example.com
A
B
Layout receives slots as props
<Layout team="…" analytics="…">
  {children}
</Layout>

A team = @team slot
B analytics = @analytics slot
PathURLSupport
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-viewsSlot sub-route
src/app/_components/Header.tsx-Ignored (_ prefix)

Dynamic Routes

Match URL segments with dynamic parameters and catch-alls.

Catch-All Routes

Match any number of trailing URL segments.

Intercepting Routes

Render alternative content when navigating from within the app.

Layouts and Pages

Create your first pages and wrap them in shared layouts.

Error Boundaries

Catch render errors and show a fallback UI.

Loading UI

Show a fallback while pages and layouts load.

Was this helpful?
PreviousDynamic Routes
NextIntercepting Routes

On this page

  • Overview
  • Convention: slots
  • default.tsx fallback
  • Behavior in Bini
  • Tab groups inside slots
  • Loading and error boundaries
  • Complete example
Edit this page on GitHub

Parallel Routes

Experimental

Parallel routes with @ slots: independent route trees passed to a layout as props.

Overview

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.

app
@team
A
page.tsx
@analytics
B
page.tsx
layout.tsx
page.tsx
example.com
A
B
Layout receives slots as props
<Layout team="…" analytics="…">
  {children}
</Layout>

A team = @team slot
B analytics = @analytics slot

The 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.

FolderCreates URL?How it renders
@teamNo - slot onlyPassed to layout as the `team` prop
@team/page.tsxYes - via parent /Renders inside the parent layout
@analytics/page.tsxYes - via parent /Renders at the same time as the main page
A slot without a receiving layout.tsx in the same directory is an error. The layout must read the slot as a prop or the build fails.

Convention: slots

Slots use the @folder convention. The tree below defines two slots: @analytics and @team, both at the app/ root.

app
@analytics
page.tsx
@team
page.tsx
layout.tsx
page.tsx

The layout.tsx receives both slots as props named after the folders:

src/app/layout.tsx
import { Outlet } from 'react-router-dom'

export default function RootLayout({
  team,
  analytics,
}: {
  team: React.ReactNode
  analytics: React.ReactNode
}) {
  return (
    <div className="grid grid-cols-[1fr_1fr] gap-4">
      <main><Outlet /></main>
      <aside>
        {team}
        {analytics}
      </aside>
    </div>
  )
}

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.

src/app/@analytics/page.tsx
// Slot content for / - does not add /@analytics to the URL
export default function AnalyticsSlot() {
  return <div>Analytics for /</div>
}
src/app/@team/page.tsx
export default function TeamSlot() {
  return <div>Team for /</div>
}

default.tsx fallback

When no route inside a slot matches the current URL, the slot renders its default.tsx (if present), or a built-in empty fallback.

app
@team
settings
page.tsx
@analytics
default.tsx
page.tsx
layout.tsx
page.tsx

Example: @team/settings/page.tsx exists, but @analytics has no /settings route. Navigating to /settings renders the @team settings page plus @analytics/default.tsx.

src/app/@analytics/default.tsx
export default function Default() {
  return <div>Select analytics view</div>
}

Behavior in Bini

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@analyticsRenders
/page.tsxpage.tsxMain page + both slots
/settingssettings/page.tsxdefault.tsx@team settings + @analytics default
/unknownno matchno matchBoth slots render their default.tsx
Data exports in slot pages (loader, action, ErrorBoundary, and the rest) are ignored. Slot pages are pure UI.

Tab groups inside slots

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.

app
@analytics
page-views
page.tsx
visitors
page.tsx
layout.tsx
...

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.

Loading and error boundaries

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.

...
@team
page.tsx
error.tsx
A
loading.tsx
@analytics
page.tsx
B
error.tsx
C
loading.tsx
layout.tsx
example.com
A
Loading...
C
Loading...
↓
example.com
B
Error...

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.

src/app/@analytics/loading.tsx
export default function Loading() {
  return <div>Loading analytics...</div>
}
src/app/@team/error.tsx
export default function Error({
  error,
  reset,
}: {
  error: Error
  reset: () => void
}) {
  return (
    <div>
      <h2>Team failed</h2>
      <button onClick={() => reset()}>Retry</button>
    </div>
  )
}

Complete example

A full example: two slots at the root, a layout that receives both as props, and the main page.

app
@team
A
page.tsx
@analytics
B
page.tsx
layout.tsx
page.tsx
example.com
A
B
Layout receives slots as props
<Layout team="…" analytics="…">
  {children}
</Layout>

A team = @team slot
B analytics = @analytics slot
PathURLSupport
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-viewsSlot sub-route
src/app/_components/Header.tsx-Ignored (_ prefix)

Dynamic Routes

Match URL segments with dynamic parameters and catch-alls.

Catch-All Routes

Match any number of trailing URL segments.

Intercepting Routes

Render alternative content when navigating from within the app.

Layouts and Pages

Create your first pages and wrap them in shared layouts.

Error Boundaries

Catch render errors and show a fallback UI.

Loading UI

Show a fallback while pages and layouts load.

Was this helpful?
PreviousDynamic Routes
NextIntercepting Routes

On this page

  • Overview
  • Convention: slots
  • default.tsx fallback
  • Behavior in Bini
  • Tab groups inside slots
  • Loading and error boundaries
  • Complete example
Edit this page on GitHub