Installation
The devtools are tree-shakeable and will be automatically excluded from production builds when using
process.env.NODE_ENV === 'production'.Basic Setup
Add the devtools component to your root route or application component:Configuration Options
Customize the devtools appearance and behavior:Props
'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
default:"bottom-left"
The position of the TanStack Router logo toggle button
boolean
default:false
Whether the devtools panel should be open by default
HTMLAttributes<HTMLDivElement>
Props to pass to the devtools panel container. Useful for adding custom styles or className
ButtonHTMLAttributes<HTMLButtonElement>
Props to pass to the toggle button. Can be used to customize appearance or extend onClick behavior
ButtonHTMLAttributes<HTMLButtonElement>
Props to pass to the close button inside the panel
string | React.ComponentType
default:"footer"
The HTML element or React component to use as the container. Useful for accessibility
AnyRouter
Explicitly pass a router instance. If not provided, the devtools will use the router from context
ShadowRoot
Attach the devtools styles to a specific Shadow DOM root
Using the Devtools Panel
The Router Devtools provide several powerful features:Route Tree View
Visualizes your entire route tree structure:- See all routes and their relationships
- Inspect route configuration (path, params, search params)
- View which routes are currently active
- Understand route hierarchy at a glance
Active Route Inspector
Inspect the currently active route:- View all matched routes in the current navigation
- See search params and their values
- Inspect path params
- View route context and loader data
- Check route state and pending status
Navigation History
Track your navigation history:- See all previous navigations
- View the navigation stack
- Inspect state changes over time
- Debug navigation issues
Router State
View the entire router state:- Current location and matches
- Pending location and matches (during navigation)
- Router options and configuration
- Cached route data
Production Builds
The devtools are automatically excluded from production builds:Standalone Panel Mode
Render the devtools panel without the toggle button:- Building custom developer tools
- Creating a dedicated debugging page
- Integrating with other devtools
- You want full control over when/where the panel appears
Custom Styling
The devtools can be styled using CSS:Shadow DOM Integration
If your application uses Shadow DOM, attach the devtools styles:Best Practices
- Add to Root Route: Place the devtools in your root route component so they’re available throughout your app
-
Development Only: Let the automatic tree-shaking handle production exclusion - don’t manually wrap in
if (process.env.NODE_ENV === 'development') - Custom Position: Choose a position that doesn’t interfere with your app’s UI
-
Panel Props: Use
panelPropsto ensure the devtools integrate well with your app’s design -
Accessibility: Use
containerElementto ensure proper semantic HTML structure
Deprecated Package
Troubleshooting
Devtools not appearing
- Ensure you’re in development mode (
process.env.NODE_ENV !== 'production') - Check that the component is rendered in your tree
- Verify no CSS is hiding the devtools
Type errors
- Ensure your router is properly registered in TypeScript
- Check that all route types are correctly inferred
- Update to the latest version of TanStack Router
Performance issues
If the devtools impact performance:- Close the panel when not in use
- Consider using panel mode only on a dedicated debug page
- Report the issue on GitHub with reproduction steps