Skip to content

marinasundstrom/BlazorBasics

Repository files navigation

Blazor Basics

A project containing various samples that demonstrate the basics of Blazor.

This project targets Blazor WebAssembly (which is client-side).

Uses Bootstrap 5 for basic styling and samples.

Links to learning resources below.

Screenshots

Goal

Providing brief but yet extensive samples demonstrating the basics of Blazor.

Answering the most common questions about building Web apps with Blazor.

When you are ready

When you feel confident in knowing the basic concepts of Blazor you can use an open-source component framework, like MudBlazor (Material UI), Radzen, or Fluent UI. They provide business-grade components.

Projects

BlazorStarterApp

The minimal required for getting started with Blazor.

Uses Bootstrap.

BlazorCounter

Several versions of the Counter component.

Demonstrates how parameters work in Blazor.

HttpClientSample

A simple demo showing how to fetch data from the web, and display it.

BlazorRouter

Demonstrates how the router works.

BlazorJSInterop

Demonstrates how to do interop between C#/.NET and JavaScript.

Requirements

To build this, you need:

Run the app

Simply:

dotnet run

or, in watch mode

dotnet watch

This will enable Hot Reload on save.

Publish the app

When you are ready to publish your app you simply run this command:

dotnet publish -c Release

This will create an optimized bundle for you.

In the process, the linker will strip out unsused dependencies in order to reduced the size.

Then you can just copy all files to your server.

Learning resources