Getting started - Blazor WebAssembly (.NET 8)
Learn how to quickly set up BlazorExpress.Bulma in your Blazor WebAssembly project using dotnet templates or manual installation, and how to register the required services.
Prerequisites #
- .NET 8 SDK (Download) or later version
- Visual Studio 2022 or later / VS Code / JetBrains Rider
- Basic knowledge of Blazor WebAssembly
1. Using dotnet Templates #
- Install the template:
TODO: Update the instructions.
The template sets up Bulma CSS, the required services, and sample components.
2. Manual Installation #
- Add the NuGet packages:
Install
BlazorExpress.Bulma. If you plan to use chart components, also installBlazorExpress.ChartJSversion1.2.2.dotnet add package BlazorExpress.Bulma dotnet add package BlazorExpress.ChartJS --version 1.2.2 - Add CSS references:
After the
basetag in theheadsection of thewwwroot/index.htmlfile, add the following references:<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.4/css/bulma.min.css"> <link rel="stylesheet" href="_content/BlazorExpress.Bulma/css/blazorexpress.bulma.css"> - Add JS references:
Insert the following references into the body section of the
wwwroot/index.htmlfile, immediately after the_framework/blazor.webassembly.jsreference. The ChartJS references are required when you use chart components and match the current docs and demos:Chart.js4.4.1andchartjs-plugin-datalabels2.2.0.<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.1/chart.umd.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-datalabels/2.2.0/chartjs-plugin-datalabels.min.js"></script> <script src="_content/BlazorExpress.ChartJS/blazorexpress.chartjs.js"></script> <script src="_content/BlazorExpress.Bulma/js/blazorexpress.bulma.js"></script> - Register services:
Add
@using BlazorExpress.Bulmato_Imports.razor:@using BlazorExpress.BulmaIf you use chart components, also add@using BlazorExpress.ChartJSto the relevant page or to a folder-level_Imports.razorfor your chart views.
3. Usage Example #
- Add a Bulma component to
Pages/Home.razor:<Button Color="ButtonColor.Primary">Hello BlazorExpress.Bulma!</Button>
4. Troubleshooting #
- Ensure all CSS and JS references are correct in
index.html. - Restart the development server after making changes to static files.
- Check the browser console for errors if components do not render as expected.