Starts in:
1 DAY
1 HR
35 MIN
57 SEC
Starts in:
1 D
1 H
35 M
57 S

There are multiple versions of this document. Pick the options that suit you best.

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.

See the Theming document to learn about themes.

Installation

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

  • Make sure AspNetCore Basic Theme installation steps are completed.

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

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

  • Perform following changes in Pages/_Host.cshtml file

    • Add usings at the top of the page.
      @using Volo.Abp.AspNetCore.Components.Server.BasicTheme.Bundling
      @using Volo.Abp.AspNetCore.Components.Web.BasicTheme.Themes.Basic
      
    • Add Basic theme style bundles between <head> tags.
      <abp-style-bundle name="@BlazorBasicThemeBundles.Styles.Global" />
      
    • Add App component of Basic Theme in the body section of page.
      <component type="typeof(App)" render-mode="Server" />
      

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 Blazor Server project directory to copy the source code to your solution:

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

Then, navigate to downloaded Volo.Abp.AspNetCore.Components.Server.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

Contributors


Last updated: July 31, 2024 Edit this page on GitHub

Was this page helpful?

Please make a selection.

To help us improve, please share your reason for the negative feedback in the field below.

Please enter a note.

Thank you for your valuable feedback!

Please note that although we cannot respond to feedback, our team will use your comments to improve the experience.

In this document
Community Talks

What’s New with .NET 9 & ABP 9?

21 Nov, 17:00
Online
Watch the Event
Mastering ABP Framework Book
Mastering ABP Framework

This book will help you gain a complete understanding of the framework and modern web application development techniques.

Learn More