Dynamic routes let you define a singleDocumentation 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.
<Route> that matches a family of URLs by using named parameters and wildcard segments. svelte5-router extracts the captured values from the URL and makes them available as component props or through the Route’s children snippet — no manual URL parsing required.
Named Parameters
A path segment prefixed with: defines a named parameter. When the route matches, the router extracts the value of that segment and passes it to the rendered component.
Accessing Params as Component Props
When you use thecomponent prop on <Route>, all matched parameters are spread directly onto the component as props:
App.svelte
routes/BlogPost.svelte
All route parameters arrive as strings. If you need a number, parse it with
parseInt(id, 10) or Number(id).Accessing Params via the Children Snippet
For cases where you want to compose the route’s content inline, use thechildren snippet. The snippet receives a params object whose keys match the parameter names defined in the path.
Passing Extra Props Through Route
Any prop on<Route> that is not path or component is forwarded to the rendered component. Combine this with named parameters to mix static and dynamic data:
BlogPost, both id (from the URL) and showComments (the static prop) will be available via $props().
Multiple Parameters
You can include several named parameters in a single path. Each is extracted independently:routes/UserProfile.svelte
Wildcard Segments
A bare* at the end of a path matches everything after that point. The captured tail is passed as the * prop (or under a custom name if you use *wildcardName).
Anonymous Wildcard
routes/FileBrowser.svelte
Named Wildcard
Give the wildcard a name by writing*wildcardName. The captured value is passed under that name instead of *, which is easier to destructure:
routes/FileBrowser.svelte
Wildcard with Children Snippet
Route Scoring Summary
svelte5-router scores routes automatically so declaration order does not matter. Given the routes below:/blog/new renders NewPost, visiting /blog/42 renders BlogPost, and visiting /blog/tag/svelte renders BlogFallback — all without any ordering concerns.