0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/docs/rfcs/parallel-route-slots/examples
Tanner Linsley 0fe6dd0613 checkpoint
History 2026-01-05 10:20:23 -07:00
..
component-routes Checkpoint 2026-01-05 09:15:36 -07:00
dashboard-widgets Checkpoint 2026-01-05 09:15:36 -07:00
modal-with-navigation checkpoint 2026-01-05 10:20:23 -07:00
nested-slots checkpoint 2026-01-05 10:20:23 -07:00
split-pane-mail checkpoint 2026-01-05 10:20:23 -07:00
README.md Checkpoint 2026-01-05 09:15:36 -07:00

Parallel Route Slots - Examples

These examples illustrate file structures and component patterns for different slot use cases.

Note: These are conceptual examples - they won't compile. They're meant to show what the developer experience would look like.

Examples

  1. modal-with-navigation - Global modal slot with internal navigation (user profiles, settings, etc.)

  2. dashboard-widgets - Route-scoped slots for parallel-loading dashboard widgets (explicit placement)

  3. component-routes - Auto-rendering widget slots with <Route.Slots> iteration, conditional enabling, and staticData-based filtering

  4. split-pane-mail - Email client with independently navigable list and preview panes

  5. nested-slots - Modal with a nested confirmation dialog slot

URL Examples

# Modal open with navigation (modal only in URL because it's navigated)
/products?@modal=/users/123&@modal.tab=profile

# Dashboard - all slots render by default, no URL params needed!
/dashboard

# Dashboard with one slot navigated away from root
/dashboard?@activity=/recent

# Dashboard with a slot explicitly disabled
/dashboard?@notifications=false

# Split pane mail - both slots render by default at their roots
/mail                                   # list and preview both at /
/mail?@list=/sent                       # list navigated to /sent
/mail?@list=/sent&@preview=/msg-456     # both navigated

# Nested slots
/app?@modal=/settings                   # modal open, confirm closed
/app?@modal=/settings&@modal@confirm    # confirm open at root
/app?@modal=/settings&@modal@confirm=/discard  # confirm at specific path

Patterns Comparison

Pattern Use Case Slot Placement URL Behavior
Modal Global overlays Explicit <Route.Outlet slot="x"> Manual open/close
Dashboard Widgets Fixed layout Explicit <Route.Outlet slot="x"> Manual open/close
Component Routes Dynamic widgets <Route.Slots> iteration defaultOpen: true auto-adds to URL
Split Pane Independent panes Explicit <Route.Outlet slot="x"> Both panes in URL
Nested Slots Layered UI Parent slot places child slots Nested @parent@child prefix