From 335248dfe4f9ed5156a6fd52fcbbc376d64da3a1 Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 12 Mar 2025 12:01:00 +0300 Subject: [PATCH] Add documentation for custom components in Blazor navigation menu --- .../en/framework/ui/blazor/navigation-menu.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/en/framework/ui/blazor/navigation-menu.md b/docs/en/framework/ui/blazor/navigation-menu.md index c9314d6022..4019538d42 100644 --- a/docs/en/framework/ui/blazor/navigation-menu.md +++ b/docs/en/framework/ui/blazor/navigation-menu.md @@ -123,6 +123,25 @@ if (await context.IsGrantedAsync("MyPermissionName")) > You can use `context.AuthorizationService` to directly access to the `IAuthorizationService`. + +### Custom Components + +Custom components can be used to render the menu items instead of the default components of the theme. The extension method named `UseComponent` from `Volo.Abp.UI.Navigation` namespace can be used to set a custom component for a menu item. + +**Example: Set a custom component for a menu item** + +```csharp +context.Menu.Items.Add( + new ApplicationMenuItem("MyProject.Crm.About", "About", "/about") + .UseComponent() + ); +``` + +_AboutMenuItemComponent.razor component will be renderd for the menu item._ + + + + ### Resolving Dependencies `context.ServiceProvider` can be used to resolve any service dependency.