Skip to main content
Path parameters allow you to capture dynamic segments from URLs and use them in your application with full type safety.

Defining Path Parameters

Path parameters are defined in route paths using special syntax:

Required Parameters

Use $ prefix for required parameters:

Optional Parameters

Use {-$paramName} for optional parameters:

Wildcard Parameters

Use $ alone to capture everything:
Access wildcards via the special _splat parameter.

Named Wildcards

Combine wildcards with names:

Using Path Parameters

Access parameters in components with useParams:

Type Safety

Specify the route for type-safe parameter access:

Parameter Parsing

Transform string parameters into typed values:
Now postId is a number instead of a string:

Validation During Parsing

Throw errors for invalid parameters:

Parameters in Loaders

Access parameters in loader functions:

Parameters in Navigation

Provide parameters when navigating:

Using Navigate

Allowed Characters

By default, path parameters are URL-encoded. Configure allowed characters:
Characters in the allowlist won’t be encoded in path parameters.

Multiple Parameters

Routes can have multiple parameters:
Access all parameters:

Inherited Parameters

Child routes inherit parameters from parents:
Access parent parameters:

Parameter Validation

Use validators for type-safe parameter parsing:

Accessing Raw Parameters

Access unparsed string parameters:

Parameter Encoding

The router handles encoding automatically:
Access the decoded value:

Building URLs with Parameters

Build URLs programmatically:

Skip Route on Parse Error

Skip routes when parameter parsing fails:
With this option:
  • Routes with failed parsing are skipped during matching
  • Router continues to find a matching route
  • Useful for fallback behavior

Common Patterns

Numeric IDs

UUID Validation

Slugs

File Paths

Next Steps

Search Params

Work with URL search parameters

Loaders

Use parameters in data loading

Type Safety

Configure end-to-end type safety

Navigation

Navigate with path parameters