Getting Started with Syncfusion Blazor Toolkit
Build your first application using Syncfusion Blazor Toolkit components in just a few simple steps. Pick a host model and ship in minutes.
Using Templates
The fastest way to get started is by using our pre-built project templates. Pick the host model that fits your application and ship in minutes.
Prerequisites
Make sure the following tools are installed before you start.
-
.NET SDK 8.0 or laterDownload from dotnet.microsoft.com
-
An IDE of your choiceVisual Studio 2022 17.8+ or Visual Studio Code with the C# Dev Kit
-
Windows, macOS, or LinuxAll Blazor host models are cross-platform
Create a New Blazor Web App Project
Create a new Blazor Web App project with the Auto interactivity mode using the blazortoolkitweb template, or use your favorite IDE.
dotnet new blazor -o BlazorWebApp
cd BlazorWebApp
dotnet run
Install Syncfusion Blazor Toolkit Package
Add the Syncfusion.Blazor.Toolkit NuGet package
to your project. Use the option that matches your workflow.
dotnet add package Syncfusion.Blazor.Toolkit
Add Import Namespaces
Open ~/_Imports.razor and add the namespace below
to make Syncfusion components available app-wide.
@using Syncfusion.Blazor.Toolkit
Register Syncfusion Blazor Toolkit Service
Register the toolkit in Program.cs so the runtime
can resolve services and theme assets. The exact registration
depends on your host model.
using Syncfusion.Blazor.Toolkit;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();
// Register Syncfusion Blazor Toolkit services
builder.Services.AddSyncfusionBlazorToolkit();
var app = builder.Build();
AddSyncfusionBlazorToolkit() service in both the server and client Program.cs files to ensure the toolkit functions correctly during server-side prerendering and client-side interactivity.
Add a Syncfusion Component
Add the render mode declaration at the top of your .razor page
and the markup below to render a toolkit Button.
Run the Application
Launch the app from your IDE or terminal. The app will launch in your default web browser, displaying the Syncfusion Blazor Toolkit Button component.
- Visual Studio Press F5 to run with debugging or Ctrl+F5 without.
- VS Code / .NET CLI
Run
dotnet runfrom the project root.