Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk3 min

TanStack Start Layouts: Pathless Routes and Outlet Explained

A pathless layout wraps matched child pages without changing their URLs. Learn the underscore filename convention, where Outlet goes, and how dynamic params fit into the route tree.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In TanStack Start, a pathless layout route wraps child pages in shared UI without adding a URL segment. In file-based routing, prefix its filename with an underscore, then place <Outlet /> in the layout where the matched child page should appear. For example, an _app layout can wrap routes that still resolve to /dashboard and /settings.

How layouts fit into TanStack Start routing

TanStack Start uses TanStack Router: the route tree nests matched route components, so a parent route can render shared interface around its child route. A layout is useful for elements such as navigation, a sidebar, or route-level logic that should apply to several pages.

The root route, conventionally src/routes/__root.tsx, is the top route and is always matched. Start’s routing guide describes it as having no path of its own; it is the natural place for document-level structure. A layout is a separate route layer within that tree.

What makes a layout route pathless?

A pathless layout participates in the component hierarchy but does not contribute a URL segment. In file-based routing, the leading underscore identifies this kind of route. The rest of its ID—such as _app—identifies the route to the router, but is not inserted into child URLs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For example, this file arrangement creates a shared layout around two pages:

src/routes/
  __root.tsx
  _app.tsx
  _app.dashboard.tsx
  _app.settings.tsx

The _app route can wrap the dashboard and settings routes while their URLs remain /dashboard and /settings. The underscore affects route structure, not the visible URL.

Where to put Outlet

<Outlet /> is the insertion point for the next potentially matching child route. Put it inside the layout component at the position where the child page should render. It is not a route or a URL token; it is a component in the parent route’s rendered tree. If no child route matches, the outlet renders nothing.

import { Outlet, createFileRoute } from '@tanstack/react-router'

export const Route = createFileRoute('/_app')({
  component: AppLayout,
})

function AppLayout() {
  return (
    <div>
      <nav>{/* shared navigation */}</nav>
      <main>
        <Outlet />
      </main>
    </div>
  )
}

Here, the navigation is shared, while the matched child page fills the main area. The route ID passed to createFileRoute corresponds to the file-based route; the router tooling generates and maintains the route tree in the documented setup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Pathless layouts compared with other route concepts

Route concept URL effect What it does Dynamic path segments
Root route (__root.tsx) Has no path of its own Top-level route, always matched; suitable for document-level structure Not applicable as a path segment
Ordinary layout route Its path contributes to matching child URLs Wraps child routes with shared UI or logic Can match path segments, subject to its route definition
Pathless layout route (_app.tsx) Adds no segment Wraps child routes without requiring a URL prefix Cannot itself match a dynamic path segment
Grouped routes Grouping alone does not change the path hierarchy Organizes routes; do not assume it provides the wrapper of a layout Depends on the routes inside the group
<Outlet /> Does not affect the URL Renders the next potentially matching child in the current route component Not applicable

Can a pathless layout capture a dynamic parameter?

No. A pathless layout does not match URL segments, so it cannot itself capture a parameter such as a post ID. The Router guide specifically rules out a dynamic pathless directory such as _$postId/. Use a path-bearing dynamic route to match the parameter, and put a pathless wrapper at a suitable parent level if the pages also need shared UI.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How the route files become a route tree

In the documented file-based setup, TanStack Router’s supported bundler plugin or CLI generates the route configuration from the route files. Treat those files and conventions as the inputs; do not manually maintain the generated route tree as though it were the source of truth. For implementation details, consult the TanStack Start routing guide, the TanStack Router routing concepts guide, the file naming conventions, and the file-based routing guide.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.