mirror of
https://github.com/TanStack/router.git
synced 2026-11-16 19:38:07 +00:00
|
History
|
||
|---|---|---|
| .. | ||
| component-routes | ||
| dashboard-widgets | ||
| modal-with-navigation | ||
| nested-slots | ||
| split-pane-mail | ||
| README.md | ||
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
-
modal-with-navigation - Global modal slot with internal navigation (user profiles, settings, etc.)
-
dashboard-widgets - Route-scoped slots for parallel-loading dashboard widgets (explicit placement)
-
component-routes - Auto-rendering widget slots with
<Route.Slots>iteration, conditional enabling, and staticData-based filtering -
split-pane-mail - Email client with independently navigable list and preview panes
-
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 |