Install Bootstrap Blazor Project Templates
mainYou can install the Bootstrap Blazor project templates using the .NET CLI to quickly scaffold new projects.
dotnet new install Bootstrap.Blazor.Templates::*repository·main·Indexed 26 days ago
https://github.com/dotnetcore/bootstrapblazorAn enterprise-level UI component library built on top of Bootstrap and Blazor. This documentation provides guides on installation via NuGet, configuring the BootstrapBlazorRoot component, registering services in Program.cs, and using CLI templates for project scaffolding.
You can install the Bootstrap Blazor project templates using the .NET CLI to quickly scaffold new projects.
dotnet new install Bootstrap.Blazor.Templates::*Wrap the @Body content in your MainLayout.razor file with the <BootstrapBlazorRoot> component to ensure the library functions correctly.
<BootstrapBlazorRoot>
@Body
</BootstrapBlazorRoot>You must include the library's bundled CSS and JavaScript files in your host HTML file (e.g., index.html for WebAssembly or _Host.cshtml/App.razor for Server).
<head> section.<body> section.Follow these steps to integrate Bootstrap Blazor into your Blazor application:
Add Namespace: Add the following to your _Imports.razor file:
@using BootstrapBlazor.ComponentsWrap Layout: Wrap the @Body content in MainLayout.razor with the BootstrapBlazorRoot component:
<BootstrapBlazorRoot>
@Body
</BootstrapBlazorRoot>Add Styles: Add the CSS bundle to your HTML head section (e.g., index.html, _Layout.cshtml, _Host.cshtml, or App.razor depending on your project type):
<link rel="stylesheet" href="_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css" />Add Scripts: Add the JavaScript bundle at the end of your HTML body:
<script src="_content/BootstrapBlazor/js/bootstrap.blazor.bundle.min.js"></script>Register Services: Register the Bootstrap Blazor services in Program.cs:
builder.Services.AddBootstrapBlazor();builder.Services.AddBootstrapBlazor();When creating a reproduction project for BootstrapBlazor, adhere to the following security and privacy rules:
Add the following using directive to your _Imports.razor file to make Bootstrap Blazor components available throughout your application:
@using BootstrapBlazor.ComponentsFollow these steps to integrate Bootstrap Blazor into your Blazor project:
_Imports.razor to include the necessary component namespace.MainLayout.razor with the <BootstrapBlazorRoot> component.index.html, _Layout.cshtml, _Host.cshtml, or App.razor).Program.cs.Program.cs file during the application builder configuration.bbapp template.When reporting an issue with BootstrapBlazor, providing a minimal reproduction project (repro) helps speed up investigations and eliminates ambiguity. A repro project should demonstrate the reported behavior with the absolute minimum amount of code required.
Empty* project templates.bin and obj folders).Note: Do not send zip attachments with issues, as they are treated as potential security risks and may not be opened.
To use Bootstrap Blazor in your project, add the NuGet package using the .NET CLI.
dotnet add package BootstrapBlazorOnce installed and configured, you can use components like Display and Button in your Razor components. Here is a basic example of data binding and event handling:
<Display Value="@_text"></Display>
<Button Text="Button" OnClick="@ClickButton"></Button>
@code {
private string? _text;
private void ClickButton(MouseEventArgs e)
{
_text = DateTime.Now.ToString();
}
}