Routeables.Razor 1.0.0

dotnet add package Routeables.Razor --version 1.0.0
                    
NuGet\Install-Package Routeables.Razor -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Routeables.Razor" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Routeables.Razor" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Routeables.Razor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Routeables.Razor --version 1.0.0
                    
#r "nuget: Routeables.Razor, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Routeables.Razor@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Routeables.Razor&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Routeables.Razor&version=1.0.0
                    
Install as a Cake Tool

Routeables.Razor

The Blazor host of Routeables: Blazor Server, Blazor WebAssembly and MAUI Blazor Hybrid. It plugs the router into Razor components and keeps the browser address in step with it. Targets .NET 10.

dotnet add package Routeables.Razor

The package brings Routeables (routing, abstractions and the source generator): there is nothing else to add.

Set up

services.UseRouteablesServer<MainViewModel>(      // or UseRouteablesWebAssembly, UseRouteablesHybrid
    r => r.AddGeneratedRoutes());

Everything is scoped, so each Blazor Server circuit has its own history, and so has its menu. Nothing is discovered for you: the main view model and the routes are what you give.

A view

@* Samples/XAnimals.Razor/Components/Animals/DogDetailView.razor *@
@inherits RouteableFor<DogDetailView, DogDetailViewModel>

<AnimalDetail ViewModel="ViewModel" />

RouteableFor<TView, TViewModel> gives the typed ViewModel and the lifecycle hooks. A zone that shows a region is <RouteableRegion Region="shell-content" />.

The layout

A layout inherits MainLayoutBase: it follows the current view, the lock and the theme. The ready-made MainLayout comes with the dialogs and notifications.

For a route declared with an explicit address (/customers/{id:int}), the browser address and the router stay in step: a route change updates the address, a typed address or the browser's back button route the router, and a refused change puts the address back.

Who decides the route: Routeables. The package ships Main.razor, whose two @page routes (/ and /{*path}) only give the Blazor router a page for every address so that it never shows NotFound; it draws nothing, and the layout shows the current view of the Routeables router. Declare the routes of the application on its view models ([Routeable("about")]) or with RegisterRoute, not with @page: a page of your own with an @page is rendered by Blazor, outside the router, and neither its history nor its guards apply to it. A layout of your own can use NavLink with the route as href, since the address follows the route.

Dialogs, modals and notifications

Drawn with plain Razor (Routeables.Razor.Services namespace). UseRouteablesServer (and UseRouteablesWebAssembly, UseRouteablesHybrid) already registers them; call UseRouteablesServices yourself only to move the notifications or replace a service:

services.UseRouteablesServer<MainViewModel>();
services.UseRouteablesServices(position: RouteableNotificationPosition.TopRight, maxDispayments: 3);   // optional

Everything is scoped. Each service has an optional factory to replace it; Reshapes.Razor.MudBlazor passes the MudBlazor ones.

  • The hosts that draw the services: RouteableDialogHost, RouteableContentDialogHost, RouteableTaskDialogHost, RouteableModalHost, RouteableNotificationHost. The default MainLayout already contains them; a layout of your own inherits MainLayoutBase and adds them.
  • RouteableModalFor<TView, TViewModel, TResult>: shows a view in a modal and returns a typed result when its view model closes.
  • NotFound, the default page for an unknown address.

Contracts: Routeables.Services.

Good to know

  • A component must be safe to dispose twice: the router disposes pages that leave its history, and Blazor disposes what it renders.
  • A Transient service that is IDisposable lives until the circuit ends: register it Scoped or Singleton. See lifecycle.
  • MudBlazor flavour: Reshapes.

Next

Hosts guide, samples Samples/XAnimals.Razor and the Blazor Server and WebAssembly heads.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 47 10/25/2026