Smart.Blazor
9.2.1
See the version list below for details.
dotnet add package Smart.Blazor --version 9.2.1
NuGet\Install-Package Smart.Blazor -Version 9.2.1
<PackageReference Include="Smart.Blazor" Version="9.2.1" />
paket add Smart.Blazor --version 9.2.1
#r "nuget: Smart.Blazor, 9.2.1"
// Install Smart.Blazor as a Cake Addin #addin nuget:?package=Smart.Blazor&version=9.2.1 // Install Smart.Blazor as a Cake Tool #tool nuget:?package=Smart.Blazor&version=9.2.1
Smart.Blazor Component Library
Smart Blazor Components is a commercial set of 60+ Blazor UI controls. Both server-side and client-side.
Getting Started
Create a new Blazor App
To start building .NET apps, download and install the .NET SDK (Software Development Kit).
- Check everything installed correctly
Once you've installed, open a new command prompt and run the following command:
dotnet
If the command runs, printing out information about how to use dotnet, you're good to go.
- Got an error?
If you receive a 'dotnet' is not recognized as an internal or external command error, make sure you opened a new command prompt
- The Blazor framework provides templates to develop apps for each of the Blazor hosting models:
Blazor WebAssembly (blazorwasm)
dotnet new blazorwasm -o BlazorApp
Blazor Server (blazorserver)
dotnet new blazorserver -o BlazorServerApp
Installation
Smart.Blazor Components are distributed as the Smart.Blazor Nuget package. You can use any of the following options:
Install the package from command line by running dotnet add package Smart.Blazor.
Alternatively, you can add the project from the Visual Nuget Package Manager.
Edit the .csproj file and add a project reference
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>BlazorApp</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Smart.Blazor" Version="8.1.3" />
</ItemGroup>
</Project>
Import the Smart.Blazor namespace.
Open the _Imports.razor file of your Blazor application and add @using Smart.Blazor
Set a Theme
Open the _Host.cshtml file (server-side Blazor) or wwwroot/index.html (client-side WebAssembly Blazor) and include a theme CSS file by adding this snippet
<link href="_content/Smart.Blazor/css/smart.default.css" rel="stylesheet" />
You can include 14+ additional CSS themes for the Controls - 7 dark and 7 light themes.
Source files
Open the _Host.cshtml file (server-side Blazor) or wwwroot/index.html (client-side WebAssembly Blazor) and include this snippet
<script src="_content/Smart.Blazor/js/smart.blazor.js"></script>
<script src="_content/Smart.Blazor/js/smart.elements.js"></script>
If you would like to use only a specific component, instead of referring the smart.elements.js
, you can refer the component like that:
<script type="module" src="_content/Smart.Blazor/js/modules/smart.table.js"></script>
Registrations
Blazor WebAssembly
This step is mandatory for Blazor WebAssembly(client-side) and also for ASP.NET Core hosted project types. You should place the code into the Program.cs of your client project
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Smart.Blazor;
namespace BlazorApp
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.Services.AddSmart();
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
await builder.Build().RunAsync();
}
}
}
Blazor Server
This step is going only into the Startup.cs of your Blazor Server project. You will need to add services.AddSmart();
in the ConfigureServices method and using Smart.Blazor;
in the using statements.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using BlazorApp.Data;
using Smart.Blazor;
namespace BlazorApp
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddSingleton<WeatherForecastService>();
services.AddSmart();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
}
}
}
Using Smart.Blazor Components
Use any Smart Blazor component by typing its tag name in a Blazor page e.g. <Button>Click Me</Button> If you are using client-side WebAssembly Blazor also add the following code to your .csproj file (after the closing RazorLangVersion element): <BlazorLinkOnBuild>false</BlazorLinkOnBuild>
Data binding a property
<Input Value="@text"></Input>
@code {
string text = " Hi from Smart!";
}
Events Handing
<Calendar id="calendar" OnChange=@OnChange></Calendar>
<div class="options">
<div class="caption">Events</div>
<div class="option" id="log">
@eventLog
</div>
</div>
@code {
private string eventLog;
private void OnChange(Event eventObj)
{
CalendarChangeEventDetail detail = eventObj\[" Detail & quot;\];
eventLog = detail.Value\[0\].ToString();
}
}
Alternatively you can do that:
@page "/calendar"
<Calendar OnReady="OnReady" id="calendar" ></Calendar>
<div class="options">
<div class="caption">Events</div>
<div class="option" id="log">
@eventLog
</div>
</div>
@code {
private string eventLog;
private void OnReady(Calendar calendar)
{
calendar.Changed += delegate (object sender, CalendarChangedEventArgs args)
{
string value = args.Value\[0\].ToString();
eventLog = value;
StateHasChanged();
};
}
}
OnReady
callback is called for each Blazor component, after it is initialized and rendered.
StateHasChanged
Notifies the component that its state has changed. When applicable, this will cause the component to be re-rendered.
AddClass
Adds a CSS class to the component.
RemoveClass
Removes a CSS class from the component.
IsDirty
Sets or gets that the component's state is dirty. On the next render, the component will be re-rendered.
Task<T> GetProperty<T>(string propertyName)
- Gets a property by its name.
SetProperty<T>(string propertyName, T value)
- Sets a property.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.AspNetCore.Components (>= 3.1.2)
- Microsoft.AspNetCore.Components.Web (>= 3.1.2)
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 12.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
20.0.64 | 356 | 10/28/2024 |
20.0.62 | 212 | 10/25/2024 |
20.0.60 | 107 | 10/24/2024 |
20.0.59 | 100 | 10/24/2024 |
20.0.58 | 123 | 10/23/2024 |
20.0.57 | 124 | 10/22/2024 |
20.0.56 | 109 | 10/22/2024 |
20.0.4 | 920 | 9/9/2024 |
19.0.5 | 2,810 | 4/25/2024 |
18.0.6 | 3,424 | 1/19/2024 |
18.0.0 | 881 | 1/16/2024 |
17.0.89 | 788 | 1/16/2024 |
17.0.35 | 1,441 | 12/1/2023 |
17.0.6 | 2,536 | 10/26/2023 |
16.0.2 | 5,251 | 8/4/2023 |
15.2.1 | 3,413 | 5/17/2023 |
15.1.1 | 3,051 | 4/1/2023 |
15.1.0 | 1,906 | 3/31/2023 |
15.0.63 | 2,293 | 3/20/2023 |
15.0.60 | 1,906 | 3/31/2023 |
14.4.136 | 3,689 | 1/18/2023 |
14.4.39 | 3,850 | 10/28/2022 |
14.2.18 | 4,615 | 7/21/2022 |
14.2.12 | 2,067 | 7/18/2022 |
14.1.1 | 2,849 | 7/5/2022 |
14.1.0 | 2,066 | 7/5/2022 |
14.0.94 | 2,350 | 6/15/2022 |
14.0.75 | 2,403 | 6/3/2022 |
14.0.51 | 3,336 | 5/17/2022 |
14.0.45 | 2,232 | 5/14/2022 |
13.1.29 | 3,547 | 4/7/2022 |
13.1.27 | 2,109 | 4/5/2022 |
13.1.25 | 2,138 | 4/4/2022 |
13.1.21 | 2,220 | 4/2/2022 |
13.1.20 | 1,786 | 4/1/2022 |
13.1.17 | 2,063 | 3/31/2022 |
13.1.12 | 1,907 | 3/29/2022 |
13.1.2 | 2,147 | 3/23/2022 |
13.0.20 | 2,050 | 3/8/2022 |
13.0.10 | 1,917 | 2/22/2022 |
13.0.8 | 2,084 | 2/21/2022 |
12.0.35 | 2,070 | 2/15/2022 |
12.0.20 | 1,878 | 2/4/2022 |
12.0.8 | 3,161 | 1/24/2022 |
12.0.1 | 1,952 | 1/20/2022 |
11.0.46 | 1,959 | 1/4/2022 |
11.0.38 | 1,769 | 12/29/2021 |
11.0.36 | 1,715 | 12/29/2021 |
11.0.35 | 1,767 | 12/29/2021 |
11.0.16 | 1,940 | 12/9/2021 |
11.0.7 | 1,862 | 12/3/2021 |
11.0.6 | 2,399 | 12/3/2021 |
11.0.4 | 1,732 | 12/2/2021 |
11.0.3 | 1,727 | 12/2/2021 |
11.0.0 | 1,738 | 11/29/2021 |
10.2.2 | 4,469 | 10/19/2021 |
10.2.1 | 1,725 | 10/19/2021 |
10.2.0 | 1,801 | 10/19/2021 |
10.0.83 | 1,830 | 10/18/2021 |
10.0.81 | 1,797 | 10/17/2021 |
10.0.77 | 1,847 | 10/14/2021 |
10.0.74 | 1,748 | 10/13/2021 |
10.0.73 | 1,715 | 10/13/2021 |
10.0.48 | 2,099 | 9/29/2021 |
10.0.45 | 1,731 | 9/27/2021 |
10.0.44 | 1,784 | 9/26/2021 |
10.0.41 | 1,730 | 9/23/2021 |
10.0.37 | 1,709 | 9/22/2021 |
10.0.36 | 1,827 | 9/22/2021 |
10.0.35 | 1,735 | 9/22/2021 |
10.0.31 | 1,921 | 9/17/2021 |
10.0.18 | 1,877 | 8/27/2021 |
10.0.15 | 1,711 | 8/26/2021 |
10.0.14 | 1,765 | 8/24/2021 |
10.0.1 | 1,924 | 8/16/2021 |
9.4.18 | 2,044 | 7/28/2021 |
9.4.15 | 1,753 | 7/16/2021 |
9.4.13 | 1,840 | 7/15/2021 |
9.4.8 | 1,646 | 7/12/2021 |
9.4.1 | 1,900 | 7/5/2021 |
9.4.0 | 1,948 | 6/30/2021 |
9.3.115 | 1,871 | 7/2/2021 |
9.3.113 | 1,793 | 6/25/2021 |
9.3.108 | 1,827 | 6/21/2021 |
9.3.97 | 1,754 | 6/8/2021 |
9.3.92 | 1,863 | 6/3/2021 |
9.3.82 | 1,825 | 5/26/2021 |
9.3.80 | 1,801 | 5/26/2021 |
9.3.66 | 1,754 | 5/19/2021 |
9.3.54 | 1,841 | 5/10/2021 |
9.3.45 | 1,982 | 5/6/2021 |
9.3.42 | 5,097 | 5/5/2021 |
9.3.39 | 1,989 | 5/1/2021 |
9.3.38 | 1,752 | 4/30/2021 |
9.3.36 | 1,725 | 4/30/2021 |
9.3.35 | 1,885 | 4/30/2021 |
9.3.34 | 1,865 | 4/29/2021 |
9.3.33 | 1,831 | 4/29/2021 |
9.3.32 | 1,759 | 4/28/2021 |
9.3.31 | 1,766 | 4/28/2021 |
9.3.30 | 1,926 | 4/27/2021 |
9.3.29 | 1,716 | 4/27/2021 |
9.3.25 | 1,689 | 4/26/2021 |
9.3.23 | 1,782 | 4/24/2021 |
9.3.22 | 1,779 | 4/23/2021 |
9.3.21 | 1,784 | 4/23/2021 |
9.3.20 | 1,741 | 4/22/2021 |
9.3.19 | 1,744 | 4/22/2021 |
9.3.18 | 1,763 | 4/22/2021 |
9.3.17 | 1,782 | 4/22/2021 |
9.3.16 | 1,727 | 4/22/2021 |
9.3.15 | 1,751 | 4/22/2021 |
9.3.14 | 1,837 | 4/22/2021 |
9.3.12 | 1,852 | 4/22/2021 |
9.3.11 | 1,791 | 4/21/2021 |
9.3.10 | 1,737 | 4/21/2021 |
9.3.9 | 1,864 | 4/21/2021 |
9.3.8 | 1,781 | 4/20/2021 |
9.3.6 | 1,863 | 4/20/2021 |
9.3.5 | 1,854 | 4/20/2021 |
9.3.4 | 1,789 | 4/19/2021 |
9.3.3 | 1,819 | 4/18/2021 |
9.3.2 | 1,809 | 4/17/2021 |
9.2.7 | 1,872 | 4/17/2021 |
9.2.5 | 1,773 | 4/16/2021 |
9.2.2 | 1,702 | 4/15/2021 |
9.2.1 | 1,837 | 4/13/2021 |
9.2.0 | 1,888 | 4/10/2021 |
9.1.6 | 1,740 | 4/7/2021 |
9.1.5 | 1,977 | 3/25/2021 |
9.1.4 | 1,994 | 3/5/2021 |
9.1.3 | 2,051 | 2/26/2021 |
9.1.1 | 2,085 | 2/3/2021 |
9.1.0 | 1,930 | 2/3/2021 |
9.0.6 | 1,955 | 2/2/2021 |
9.0.5 | 1,937 | 1/15/2021 |
9.0.4 | 2,054 | 1/14/2021 |
9.0.3 | 1,940 | 1/11/2021 |
9.0.2 | 2,133 | 12/27/2020 |
9.0.1 | 2,150 | 12/27/2020 |
9.0.0 | 2,009 | 12/27/2020 |
8.2.0 | 3,648 | 12/22/2020 |
8.1.17 | 2,104 | 12/9/2020 |
8.1.14 | 1,973 | 12/8/2020 |
8.1.13 | 2,102 | 12/2/2020 |
8.1.12 | 2,046 | 11/26/2020 |
8.1.10 | 2,112 | 11/25/2020 |
8.1.9 | 1,986 | 11/25/2020 |
8.1.8 | 1,965 | 11/24/2020 |
8.1.7 | 2,121 | 11/5/2020 |
8.1.6 | 1,967 | 11/3/2020 |
8.1.5 | 2,089 | 11/1/2020 |
8.1.4 | 2,016 | 10/29/2020 |
8.1.3 | 1,957 | 10/13/2020 |
8.1.2 | 291 | 10/13/2020 |
8.1.1 | 265 | 10/13/2020 |
8.1.0 | 366 | 10/13/2020 |
Deprecated RefreshState. Use StateHasChanged instead.
Extended Tree component with Children collection for easy access to children