Project Templates
The Telerik.Blazor.Templates NuGet package provides standard ASP.NET Core Blazor project templates with a pre-configured Telerik UI for Blazor library. This article explains how to use the project templates.
Install
By default, the Telerik.Blazor.Templates NuGet package is installed during the execution of the Telerik.CLI setup command.
To install the Telerik UI for Blazor project templates separately:
- Close your IDE, for example, Visual Studio.
- Open your Terminal or Shell app.
- Execute the
dotnet new installcommand:shdotnet new install Telerik.Blazor.Templates
The package installs the following project templates:
| Template Name | CLI Short Name |
|---|---|
| Telerik Blazor Web App | telerik-blazor |
| Telerik Blazor WebAssembly Standalone App | telerik-blazorwasm |
| Telerik Blazor MAUI Hybrid App | telerik-blazor-maui |
Use with Visual Studio
The Telerik UI for Blazor project templates appear in the C#, Web and Blazor categories in the Create New Project wizard. Make sure to select "All platforms" in the respective dropdown.
When creating a Blazor Web App with WebAssembly or Auto render mode, make sure to select the server project as a startup project before running.
Use with VS Code
Install the C# Dev Kit extension.
To create a new app:
- Go to the Command Palette at the top (
Ctrl+Shift+Pon Windows orCmd+Shift+Pon Mac). - Select Show and Run Commands.
- Select .NET: New Project...
- Type a project name and configure the project template options.
Use with the .NET CLI
To see all available project templates, execute the dotnet new list command with the --author option:
dotnet new list --author="Progress"
For help on a specific project or item template, execute the dotnet new command with the --help option, for example:
dotnet new telerik-blazor --help
To create a new Blazor app:
- Open your Terminal or Shell app and go to the desired parent folder of your future app.
- Execute the
dotnet newcommand with the short name of the template and the app name, for example:shdotnet new telerik-blazor -o MyNewAppName
Features and Configuration
The Telerik Blazor project templates differ in the following ways from the standard .NET Blazor project templates:
- The Blazor Web Apps always use a Global interactivity location, i.e. interactive render mode for the entire app. This is the easier and recommended way to integrate Telerik UI for Blazor.
- The WebAssembly apps reference the latest minor version of the selected .NET version through a wildcard
*. - The apps use the
httpslaunch profile by default. - Visual Studio opens
Home.razorautomatically after the app is created.
The Telerik-specific project template features include:
- The apps reference the latest Telerik UI for Blazor version with a wildcard
*. - The Telerik UI for Blazor NuGet package, namespaces, service, and static assets are added, according to best practices.
- The Web App template sets
PrivateAssets="none"to the Telerik UI for Blazor NuGet package reference when using WebAssembly or Auto render mode. This avoids license warnings on app startup.
The project templates provide options to configure the Telerik Blazor components during app creation:
| Template Option | Default Value | Description |
|---|---|---|
| Theme | Default | The Telerik UI for Blazor NuGet package includes a few CSS files that define different styling of the Telerik Blazor components. |
| Icon type | SVG | Telerik Blazor components can render SVG icons or font icons. |
Update
The Telerik.Blazor.Templates NuGet package is updated automatically every time you use the Telerik CLI create command. Another option is to execute the dotnet new update command:
dotnet new update Telerik.Blazor.Templates
Uninstall
To remove the currently installed package, execute the dotnet new uninstall command:
dotnet new uninstall Telerik.Blazor.Templates