This is a Blazor component for displaying a customizable loading spinner with an overlay. It can be used to indicate that a page or part of a page is loading. The component is designed to be easily reusable and flexible, with options for customizing the spinner's color, overlay color, and whether the overlay should cover the whole page or just a specific section.
- Display a loading spinner with a customizable overlay.
- Optionally cover the entire page or just a part of it.
- Configurable colors for the spinner and overlay.
To use this component, you can install it as a NuGet package.
-
Open your Blazor project in Visual Studio or your preferred IDE.
-
Install the NuGet package from the NuGet Gallery:
dotnet add package BlazorLoadingSpinner
@using [Your Namespace].Components
@* Some page in your app *@
<LoadingSpinner IsLoading="@isLoading" FullPage="@true"></LoadingSpinner>
@code {
private bool isLoading = true;
// ... (your logic to control isLoading)
}@using [Your Namespace].Components
@* Some page in your app *@
<LoadingSpinner IsLoading="@isLoading" FullPage="@false">
@* Place the section that should be covered by overlay in here*@
<div>blablabla</div>
</LoadingSpinner>
@code {
private bool isLoading = true;
// ... (your logic to control isLoading)
}IsLoading(bool): Controls whether the loading spinner is displayed. Set this totruewhen you want to show the spinner andfalsewhen you want to hide it.ChildContent(RenderFragment): The content to display when the spinner is not active.FullPage(bool): If set totrue, the spinner will cover the full page. Iffalse, it the part that is passed in asChildContent(passed in between the opening and closingLoadingSpinnertag).OverlayColor(Color): The color of the overlay (background). Default is a semi-transparent black (rgba(0, 0, 0, 0.7)).SpinnerColor(Color): The color of the spinner. Default is a semi-transparent white (rgba(255, 255, 255, 0.4)).
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.