dotnet / dotnet/aspnetcore

[Blazor] Enable creating dynamic routes

Open
#45,396 3 comments 1 reaction 0 assignees View on GitHub
area-blazor enhancement feature-blazor-routing feature-blazor-wasm
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

This is not a problem in Blazor, but a feature request.

**Scenario**
A Blazor component is created in a Razor Class Library, with its own route:

@page "/parameters"

My parameters page

This external component is imported in a Blazor app with AdditionalAssemblies parameter:

The goal is that the Blazor app can choose a different route to this external component (from config file for example).

Currently routing is static on Blazor applications. The routes get defined on pages that are stamped as attributes on the component types and attribute types must be compile time constants.

This prevents creating a custom route for this external component from the main Blazor app.

### Describe the solution you'd like

Make routes dynamic so that this kind of scenario is possible.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.