svelte5-router is a declarative routing library purpose-built for Svelte 5. It providesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jpcutshall/svelte5-router/llms.txt
Use this file to discover all available pages before exploring further.
Router, Route, and Link components alongside imperative utilities like navigate(), Svelte actions for anchor-based routing, context hooks, and experimental view transitions — all with full TypeScript support and SSR capability.
Installation
Add svelte5-router to your Svelte 5 project in one command.
Quickstart
Build a working multi-page app in minutes with Router, Route, and Link.
Guides
Learn dynamic routes, nested routers, lazy loading, SSR, and more.
API Reference
Full reference for every component, function, action, and hook.
What’s included
Router
Top-level context provider that scores and picks the best matching route.
Route
Renders its component or children snippet when the path matches.
Link
Accessible navigation anchor with active-state detection.
navigate()
Imperatively navigate from event handlers and async callbacks.
Lazy loading
Code-split routes with the
dynamic() helper.SSR support
Force the URL server-side via the
url prop on Router.Quick example
App.svelte
Wrap your app in Router
Add a
<Router> at the top of your component tree. Pass the url prop for SSR support.