2 Answer(s)
-
0
- Solution
- If you use the built-in Identity UI (ABP Blazor), the recommended way to change the Users/Roles UI is to override the related Blazor components and/or extend the toolbars/actions instead of forking the module. ABP makes these components replaceable.
- To replace the Users and Roles pages with your own components:
- Create new components that inherit the originals and mark them to replace the services. Example: override Users page
@using Microsoft.AspNetCore.Authorization @using Volo.Abp.DependencyInjection @using Volo.Abp.Identity @using Volo.Abp.Identity.Blazor.Pages.Identity @attribute [Authorize(IdentityPermissions.Users.Default)] @attribute [ExposeServices(typeof(UserManagement))] @attribute [Dependency(ReplaceServices = true)] @inherits UserManagement <!-- Your customized Users UI goes here -->Example: override Roles page
@using Microsoft.AspNetCore.Authorization @using Volo.Abp.DependencyInjection @using Volo.Abp.Identity @using Volo.Abp.Identity.Blazor.Pages.Identity @attribute [Authorize(IdentityPermissions.Roles.Default)] @attribute [ExposeServices(typeof(RoleManagement))] @attribute [Dependency(ReplaceServices = true)] @inherits RoleManagement <!-- Your customized Roles UI goes here -->You can fully redesign the UI (e.g., use MudBlazor, change dialogs to full-page EditForm, etc.) while reusing the base logic by calling the protected members like AppService, MapToCreateInput, MapToEditingEntity, GetListInput, and permission properties.
- To add extra buttons or commands without rewriting the whole page, use Page Toolbar Extensions or Entity Action Extensions:
- Page toolbar example (add “Import users” on Users page):
public class UsersPageToolbarContributor : IPageToolbarContributor { public Task ConfigureAsync(PageToolbarContributionContext context) { if (context.PageName == IdentityPageNames.Users) { context.Toolbar.Items.Add(new PageToolbarItem { Text = "Import users", Icon = "upload", OnClick = async () => { // your import logic } }); } return Task.CompletedTask; } }Register contributor in your module:Configure<PageToolbarOptions>(opts => { opts.Contributors.Add(new UsersPageToolbarContributor()); });- If you extended IdentityUser (e.g., added Code, Address, Manager, etc.) and want these fields to appear on the Users page and also in profile management:
- Configure module extension mappings to include your extra properties in the relevant DTOs:
public override void PostConfigureServices(ServiceConfigurationContext context) { ModuleExtensionConfigurationHelper.ApplyEntityConfigurationToApi( IdentityModuleExtensionConsts.ModuleName, IdentityModuleExtensionConsts.EntityNames.User, getApiTypes: new[] { typeof(IdentityUserDto), typeof(ProfileDto) }, createApiTypes: new[] { typeof(IdentityUserCreateDto) }, updateApiTypes: new[] { typeof(IdentityUserUpdateDto), typeof(UpdateProfileDto) } ); }- In your overridden components, bind to those properties via ExtraProperties or strongly typed extension helpers (depending on how you defined them) and map them when creating/updating users.
- About Identity Pro for Blazor:
- If you own ABP Commercial and want to use Volo.Abp.Identity.Pro.Blazor, add the package to your Blazor UI project and depend on the module in your Blazor module:
[DependsOn(typeof(Volo.Abp.Identity.Pro.Blazor.AbpIdentityProBlazorModule))] public class YourBlazorModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { // your customizations } }- Then use the same override technique if you need to change specific Pro components: create a component inheriting the Pro component class and annotate with:
[ExposeServices(typeof(TheProBaseComponentYouOverride))] [Dependency(ReplaceServices = true)]You can still use PageToolbar and EntityAction extensions for Pro pages.
Notes and tips:
- Overriding components requires the correct base class type in ExposeServices. For the Users page it’s UserManagement; for the Roles page it’s RoleManagement.
- If you encounter missing symbol errors like “UserName not defined” when copying snippets from docs, ensure your .razor file inherits the correct base partial class (e.g., @inherits UserManagement) and you placed any backing partial class members or injected services expected by that markup.
- Prefer extension points (toolbar/entity actions) for light customizations. For heavy UI redesigns, overriding the page component is fine.
- For profile management (My Profile) changes, use ProfileManagementPage contributors to add/replace tabs without forking the Account module; if you want your user extra fields to save, include UpdateProfileDto/ProfileDto in ApplyEntityConfigurationToApi as shown above.
- Sources
- https://abp.io/docs/latest/framework/architecture/modularity/basics
- https://abp.io/docs/latest/modules/identity
- https://abp.io/docs/latest/modules/identity-pro
- https://abp.io/docs/latest/framework/ui/blazor/page-toolbar-extensions
- https://github.com/abpframework/abp
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
hi
Blazor UI: Customization / Overriding Components
This document explains how to override the user interface of a depended application module or theme for Blazor applications.
https://abp.io/docs/latest/framework/ui/blazor/customization-overriding-components