版本
语言

本文档有多个版本。请选择最适合您的选项。

UI

Blazor UI: Basic Theme

The Basic Theme is a theme implementation for the Blazor UI. It is a minimalist theme that doesn't add any styling on top of the plain Bootstrap. You can take the Basic Theme as the base theme and build your own theme or styling on top of it. See the Customization section.

If you are looking for a professional, enterprise ready theme, you can check the Lepton Theme, which is a part of the ABP Commercial.

See the Theming document to learn about themes.

Installation

If you need to manually this theme, follow the steps below:

  • Install the Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme NuGet package to your web project.

  • Add AbpAspNetCoreComponentsWebAssemblyBasicThemeModule into the [DependsOn(...)] attribute for your module class in the your Blazor UI project.

  • Use Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Themes.Basic.App as the root component of your application in the ConfigureServices method of your module:

    var builder = context.Services.GetSingletonInstance<WebAssemblyHostBuilder>();
    builder.RootComponents.Add<App>("#ApplicationContainer");
    

    #ApplicationContainer is a selector (like <div id="ApplicationContainer">Loading...</div>) in the index.html.

  • Execute abp bundle command under blazor project once.

The Layout

basic-theme-application-layout

Application Layout implements the following parts, in addition to the common parts mentioned above;

Customization

You have two options two customize this theme:

Overriding Styles / Components

In this approach, you continue to use the theme as NuGet and NPM packages and customize the parts you need to. There are several ways to customize it;

Override the Styles

You can simply override the styles in the Global Styles file of your application.

Override the Components

See the Customization / Overriding Components to learn how you can replace components, customize and extend the user interface.

Overriding the Menu Item

Basic theme supports overriding a single menu item with a custom component. You can create a custom component and call UseComponent extension method in the MenuContributor.

using Volo.Abp.UI.Navigation;

//...

context.Menu.Items.Add(
  new ApplicationMenuItem("Custom.1", "My Custom Menu", "#")
    .UseComponent(typeof(MyMenuItemComponent)));
<li class="nav-item">
    <a href="#" class="nav-link">
        My Custom Menu
    </a>
</li>

Copy & Customize

You can run the following ABP CLI command in BlazorWebAssembly project directory to copy the source code to your solution:

abp add-package Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme --with-source-code --add-to-solution-file

Then, navigate to downloaded Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme project directory and run:

abp add-package Volo.Abp.AspNetCore.Components.Web.BasicTheme --with-source-code --add-to-solution-file


Or, you can download the source code of the Basic Theme, manually copy the project content into your solution, re-arrange the package/module dependencies (see the Installation section above to understand how it was installed to the project) and freely customize the theme based on your application requirements.

See Also

本页对您有帮助吗?
请进行选择。
感谢您的宝贵意见!

请注意,虽然我们无法回复反馈意见,但我们的团队会根据您的意见改进体验。

在本文档中
Mastering ABP Framework Book
掌握 ABP 框架

本书将帮助你全面了解框架和现代Web应用程序开发技术。