Skip to content

Commit 0e8465e

Browse files
Merge pull request #7236 from syncfusion-content/984330-AI-Prompt
Updated Blazor components Getting Started UG documentation for Blazor Web App
2 parents 045c2e8 + 8664a49 commit 0e8465e

36 files changed

+1250
-793
lines changed

blazor/datagrid/how-to/create-custom-grid-component.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ Create a reusable custom Grid component by wrapping the `SfGrid` in a Razor comp
1313

1414
The following example creates a `CustomGrid` wrapper that renders `SfGrid` with default properties such as `GridPageSettings`. Any unmatched attributes passed to `CustomGrid` are forwarded to the inner `SfGrid`, and content placed inside `CustomGrid` is projected as columns via `ChildContent`.
1515

16-
CustomGrid.razor
16+
**CustomGrid.razor:**
17+
18+
{% tabs %}
19+
{% highlight C# tabtitle="CustomGrid.razor" %}
1720

18-
```cshtml
1921
@using Syncfusion.Blazor.Grids
2022
@typeparam TItem
2123

@@ -30,11 +32,15 @@ CustomGrid.razor
3032
</GridPageSettings>
3133
@ChildContent
3234
</SfGrid>
33-
```
3435

35-
CustomGrid.razor.cs
36+
{% endhighlight %}
37+
{% endtabs %}
38+
39+
**CustomGrid.razor.cs:**
40+
41+
{% tabs %}
42+
{% highlight C# tabtitle="CustomGrid.razor.cs" %}
3643

37-
```csharp
3844
using Microsoft.AspNetCore.Components;
3945
using Syncfusion.Blazor.Grids;
4046
using System;
@@ -60,11 +66,15 @@ namespace SF_Grid_Inheritance.Shared
6066
public IReadOnlyDictionary<string, object>? AdditionalAttributes { get; set; }
6167
}
6268
}
63-
```
6469

65-
Index.razor
70+
{% endhighlight %}
71+
{% endtabs %}
72+
73+
**Index.razor:**
74+
75+
{% tabs %}
76+
{% highlight C# tabtitle="Index.razor" %}
6677

67-
```razor
6878
@using SF_Grid_Inheritance.Shared
6979
@using Syncfusion.Blazor.Grids
7080

@@ -100,4 +110,6 @@ Index.razor
100110
public double? Freight { get; set; }
101111
}
102112
}
103-
```
113+
114+
{% endhighlight %}
115+
{% endtabs %}

blazor/datagrid/how-to/css-isolation-for-grid.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ To enable CSS isolation for the Grid, it is recommended to wrap the `SfGrid` ins
1515

1616
Below is an example of implementing a simple Grid inside the **Index.razor** file:
1717

18-
```razor
19-
Index.razor
18+
{% tabs %}
19+
{% highlight C# tabtitle="Index.razor" %}
2020

2121
@using Syncfusion.Blazor.Grids
2222

@@ -57,7 +57,9 @@ Index.razor
5757
public string ShipCountry { get; set; }
5858
}
5959
}
60-
```
60+
61+
{% endhighlight %}
62+
{% endtabs %}
6163

6264
```css
6365
Index.razor.css

blazor/rich-text-editor/http-client-instance.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ The Rich Text Editor component in Blazor enables you to utilize the `HttpClientI
1313

1414
The following example illustrates how to configure the Rich Text Editor component with HttpClient in a Blazor application.
1515

16-
```razor
16+
{% tabs %}
17+
{% highlight razor %}
18+
1719
@using Syncfusion.Blazor.RichTextEditor
1820
@inject HttpClient httpClient
1921

@@ -34,11 +36,15 @@ The following example illustrates how to configure the Rich Text Editor componen
3436
await base.OnInitializedAsync();
3537
}
3638
}
37-
```
39+
40+
{% endhighlight %}
41+
{% endtabs %}
3842

3943
## Program.cs
4044

41-
```csharp
45+
{% tabs %}
46+
{% highlight c# tabtitle="Program.cs" %}
47+
4248
using Syncfusion.Blazor;
4349

4450
var builder = WebApplication.CreateBuilder(args);
@@ -60,4 +66,5 @@ builder.Services.AddScoped(sp =>
6066
});
6167
var app = builder.Build();
6268

63-
```
69+
{% endhighlight %}
70+
{% endtabs %}

blazor/speeddial/getting-started-webapp.md

Lines changed: 77 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ documentation: ug
99

1010
# Getting Started with Blazor SpeedDial in Blazor Web App
1111

12-
This section explains how to add the Blazor Speed Dial component to a Blazor Web App using Visual Studio or Visual Studio Code.
12+
This section briefly explains about how to include `Blazor SpeedDial` component in your Blazor Web App using [Visual Studio](https://visualstudio.microsoft.com/vs/), [Visual Studio Code](https://code.visualstudio.com/), and the [.NET CLI](https://learn.microsoft.com/en-us/dotnet/core/tools/).
1313

1414
{% tabcontents %}
1515

@@ -21,17 +21,19 @@ This section explains how to add the Blazor Speed Dial component to a Blazor Web
2121

2222
## Create a new Blazor Web App in Visual Studio
2323

24-
Create a Blazor Web App using Visual Studio 2022 via [Microsoft templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0) or the [Syncfusion Blazor extension](https://blazor.syncfusion.com/documentation/visual-studio-integration/template-studio).
24+
Create a **Blazor Web App** using Visual Studio 2022 via [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-10.0&pivots=vs) or the [Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-integration/template-studio).
2525

26-
Configure the appropriate [interactive render mode](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-8.0#render-modes) and [interactivity location](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0&pivots=windows) when creating the Blazor Web App.
26+
Configure the appropriate [Interactive render mode](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-10.0#render-modes) and [Interactivity location](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-10.0&pivots=vs) while creating a Blazor Web App.
27+
28+
![Create Blazor Web App](images/blazor-create-web-app.png)
2729

2830
## Install Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Buttons and Themes NuGet in the App
2931

30-
To add the Blazor Speed Dial component to the app, open the NuGet Package Manager in Visual Studio (Tools → NuGet Package Manager → Manage NuGet Packages for Solution), then search for and install [Syncfusion.Blazor.Buttons](https://www.nuget.org/packages/Syncfusion.Blazor.Buttons) and [Syncfusion.Blazor.Themes](https://www.nuget.org/packages/Syncfusion.Blazor.Themes/).
32+
To add the **Blazor SpeedDial** component in the app, open the NuGet package manager in Visual Studio (*Tools → NuGet Package Manager → Manage NuGet Packages for Solution*), then search and install [Syncfusion.Blazor.Buttons](https://www.nuget.org/packages/Syncfusion.Blazor.Buttons) and [Syncfusion.Blazor.Themes](https://www.nuget.org/packages/Syncfusion.Blazor.Themes/).
3133

32-
If you use the WebAssembly or Auto render modes in the Blazor Web App, you need to install the Syncfusion Blazor NuGet packages in the client project.
34+
If using the `WebAssembly or Auto` render modes in the Blazor Web App, install Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor component NuGet packages in the client project.
3335

34-
Alternatively, use the following Package Manager commands:
36+
Alternatively, run the following commands in the Package Manager Console to achieve the same.
3537

3638
{% tabs %}
3739
{% highlight C# tabtitle="Package Manager" %}
@@ -42,7 +44,7 @@ Install-Package Syncfusion.Blazor.Themes -Version {{ site.releaseversion }}
4244
{% endhighlight %}
4345
{% endtabs %}
4446

45-
N> Syncfusion Blazor components are available on NuGet.org. For the full list of available packages, see [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages).
47+
N> Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor components are available in [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). Refer to the [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) topic for available NuGet packages list with component details.
4648

4749
{% endtabcontent %}
4850

@@ -54,11 +56,11 @@ N> Syncfusion Blazor components are available on NuGet.org. For the full list of
5456

5557
## Create a new Blazor Web App in Visual Studio Code
5658

57-
Create a Blazor Web App using Visual Studio Code via [Microsoft templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0&pivots=vsc) or the [Syncfusion Blazor extension](https://blazor.syncfusion.com/documentation/visual-studio-code-integration/create-project).
59+
Create a **Blazor Web App** using Visual Studio Code via [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-10.0&pivots=vsc) or the [Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-code-integration/create-project).
5860

59-
Configure the appropriate [interactive render mode](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-8.0#render-modes) and [interactivity location](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0&pivots=vsc) when creating the Blazor Web App.
61+
Configure the appropriate interactive render mode and interactivity location when setting up a Blazor Web App. For detailed information, refer to the [interactive render mode documentation](https://blazor.syncfusion.com/documentation/common/interactive-render-mode).
6062

61-
For example, in a Blazor Web App with the Auto interactive render mode, run the following commands:
63+
For example, to create a Blazor Web App with the `Auto` interactive render mode, use the following commands.
6264

6365
{% tabs %}
6466
{% highlight c# tabtitle="Blazor Web App" %}
@@ -70,11 +72,9 @@ cd BlazorWebApp.Client
7072
{% endhighlight %}
7173
{% endtabs %}
7274

73-
N> For more information on creating a Blazor Web App with various interactive modes and locations, see [Blazor Web App interactive modes and locations](https://blazor.syncfusion.com/documentation/getting-started/blazor-web-app?tabcontent=visual-studio-code#render-interactive-modes).
74-
7575
## Install Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Buttons and Themes NuGet in the App
7676

77-
If utilize `WebAssembly` or `Auto` render modes in the Blazor Web App need to be install Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor components NuGet packages within the client project.
77+
If using the `WebAssembly` or `Auto` render modes in the Blazor Web App, install Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor component NuGet packages in the client project.
7878

7979
* Press <kbd>Ctrl</kbd>+<kbd>`</kbd> to open the integrated terminal in Visual Studio Code.
8080
* Ensure you’re in the project root directory where your `.csproj` file is located.
@@ -92,20 +92,69 @@ dotnet restore
9292

9393
{% endtabs %}
9494

95-
N> Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor components are available in [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). Refer to [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) topic for available NuGet packages list with component details.
95+
N> Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor components are available in [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). Refer to the [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) topic for the available NuGet packages list with component details.
9696

9797
{% endtabcontent %}
9898

99-
{% endtabcontents %}
99+
{% tabcontent .NET CLI %}
100100

101-
## Register Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Service
101+
## Prerequisites
102+
103+
Latest version of the [.NET SDK](https://dotnet.microsoft.com/en-us/download). If you previously installed the SDK, you can determine the installed version by executing the following command in a command prompt (Windows) or terminal (macOS) or command shell (Linux).
104+
105+
{% tabs %}
106+
{% highlight c# tabtitle=".NET CLI" %}
107+
108+
dotnet --version
109+
110+
{% endhighlight %}
111+
{% endtabs %}
112+
113+
## Create a Blazor Web App using .NET CLI
114+
115+
Run the following command to create a new Blazor Web App in a command prompt (Windows) or terminal (macOS) or command shell (Linux). For detailed instructions, refer to [this Blazor Web App Getting Started](https://blazor.syncfusion.com/documentation/getting-started/blazor-web-app?tabcontent=.net-cli) documentation.
116+
117+
Configure the appropriate interactive render mode and interactivity location when setting up a Blazor Web Application. For detailed information, refer to the [interactive render mode documentation](https://blazor.syncfusion.com/documentation/common/interactive-render-mode).
102118

103-
| Interactive Render Mode | Description |
104-
| -- | -- |
105-
| WebAssembly or Auto | Open **~/_Imports.razor** from the client project. |
106-
| Server | Open **~/_Imports.razor** (typically in the Components folder). |
119+
For example, to create a Blazor Web App with the `Auto` interactive render mode, use the following commands:
107120

108-
Import the `Syncfusion.Blazor` and `Syncfusion.Blazor.Buttons` namespaces.
121+
{% tabs %}
122+
{% highlight c# tabtitle=".NET CLI" %}
123+
124+
dotnet new blazor -o BlazorApp -int Auto
125+
cd BlazorApp
126+
cd BlazorApp.Client
127+
128+
{% endhighlight %}
129+
{% endtabs %}
130+
131+
This command creates a new Blazor Web App and places it in a new directory called `BlazorApp` inside your current location. See the [Create a Blazor App](https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/create) and [dotnet new CLI command](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?pivots=cli&view=aspnetcore-10.0) topics for more details.
132+
133+
## Install Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Buttons and Themes NuGet in the App
134+
135+
Here's an example of how to add **Blazor Speed Dial** component in the application using the following command in the command prompt (Windows) or terminal (Linux and macOS) to install a [Syncfusion.Blazor.Buttons](https://www.nuget.org/packages/Syncfusion.Blazor.Buttons/) and [Syncfusion.Blazor.Themes](https://www.nuget.org/packages/Syncfusion.Blazor.Themes/) NuGet package. See [Install and manage packages using the dotnet CLI](https://learn.microsoft.com/en-us/nuget/consume-packages/install-use-packages-dotnet-cli) topics for more details.
136+
137+
If using the `WebAssembly or Auto` render modes in the Blazor Web App, install Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor component NuGet packages in the client project.
138+
139+
{% tabs %}
140+
{% highlight c# tabtitle=".NET CLI" %}
141+
142+
dotnet add package Syncfusion.Blazor.Buttons --version {{ site.releaseversion }}
143+
dotnet add package Syncfusion.Blazor.Themes --version {{ site.releaseversion }}
144+
dotnet restore
145+
146+
{% endhighlight %}
147+
{% endtabs %}
148+
149+
N> Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor components are available in [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). Refer to the [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) topic for the available NuGet packages list with component details.
150+
151+
{% endtabcontent %}
152+
153+
{% endtabcontents %}
154+
155+
## Add Import Namespaces
156+
157+
Open the **~/_Imports.razor** file from the client project and import the `Syncfusion.Blazor` and `Syncfusion.Blazor.Buttons` namespace.
109158

110159
{% tabs %}
111160
{% highlight C# tabtitle="~/_Imports.razor" %}
@@ -116,9 +165,11 @@ Import the `Syncfusion.Blazor` and `Syncfusion.Blazor.Buttons` namespaces.
116165
{% endhighlight %}
117166
{% endtabs %}
118167

119-
Now register the Syncfusion Blazor service in the **~/Program.cs** file of the Blazor Web App.
168+
## Register Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Service
169+
170+
Register the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Service in the **~/Program.cs** file of your Blazor Web App.
120171

121-
If the interactive render mode is set to WebAssembly or Auto, register the Syncfusion Blazor service in both **~/Program.cs** files (server and client) of the Blazor Web App.
172+
If the **Interactive Render Mode** is set to `WebAssembly` or `Auto`, register the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor service in the **~/Program.cs** files of the main `server` project and associated `.Client` project.
122173

123174
{% tabs %}
124175
{% highlight c# tabtitle="Server(~/_Program.cs)" hl_lines="3 11" %}
@@ -152,27 +203,6 @@ await builder.Build().RunAsync();
152203
{% endhighlight %}
153204
{% endtabs %}
154205

155-
If the **Interactive Render Mode** is set to `Server`, your project will contain a single **~/Program.cs** file. So, you should register the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor Service only in that **~/Program.cs** file.
156-
157-
{% tabs %}
158-
{% highlight c# tabtitle="~/_Program.cs" hl_lines="2 9" %}
159-
160-
...
161-
using Syncfusion.Blazor;
162-
163-
var builder = WebApplication.CreateBuilder(args);
164-
165-
// Add services to the container.
166-
builder.Services.AddRazorComponents()
167-
.AddInteractiveServerComponents();
168-
builder.Services.AddSyncfusionBlazor();
169-
170-
var app = builder.Build();
171-
....
172-
173-
{% endhighlight %}
174-
{% endtabs %}
175-
176206
## Add stylesheet and script resources
177207

178208
The theme stylesheet and script are provided via NuGet as [static web assets](https://blazor.syncfusion.com/documentation/appearance/themes#static-web-assets). Add the stylesheet reference in the head and the script reference at the end of the body in **~/Components/App.razor** as shown below. The script enables client-side interactivity for Syncfusion components.
@@ -194,16 +224,15 @@ N> Check out the [Blazor Themes](https://blazor.syncfusion.com/documentation/app
194224

195225
## Add Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor SpeedDial component
196226

197-
Add the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor SpeedDial component in the **~Pages/.razor** file. If an interactivity location as `Per page/component` in the web app, define a render mode at the top of the `~Pages/.razor` component, as follows:
227+
Add the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor SpeedDial component to a Razor page located under the Pages folder (e.g., Pages/Home.razor) in either the **Server** or **Client** project. If an interactivity location as `Per page/component` in the web app, define a render mode at top of the component, as follows:
198228

199229
| Interactivity location | RenderMode | Code |
200230
| --- | --- | --- |
201231
| Per page/component | Auto | @rendermode InteractiveAuto |
202232
| | WebAssembly | @rendermode InteractiveWebAssembly |
203-
| | Server | @rendermode InteractiveServer |
204233
| | None | --- |
205234

206-
N> If the interactivity location is set to Global and the render mode is Auto, WebAssembly, or Server, the render mode is configured in the App.razor file by default.
235+
N> If an **Interactivity Location** is set to `Global` and the **Render Mode** is set to `Auto` or `WebAssembly`, the render mode is configured in the `App.razor` file by default.
207236

208237
{% tabs %}
209238
{% highlight razor %}
@@ -230,7 +259,7 @@ N> If the interactivity location is set to Global and the render mode is Auto, W
230259
{% endhighlight %}
231260
{% endtabs %}
232261

233-
* Press <kbd>Ctrl</kbd>+<kbd>F5</kbd> (Windows) or <kbd>⌘</kbd>+<kbd>F5</kbd> (macOS) to launch the application. This will render the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor SpeedDial component in your default web browser.
262+
* Press <kbd>Ctrl</kbd>+<kbd>F5</kbd> (Windows) or <kbd>⌘</kbd>+<kbd>F5</kbd> (macOS) to launch the application. This will render the Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor SpeedDial component in the default web browser.
234263

235264
{% previewsample "https://blazorplayground.syncfusion.com/embed/rZrfjigtfqnDNcxJ?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" backgroundimage "[Blazor SpeedDial Component](./images/blazor-speeddial-component.png)" %}
236265

79.4 KB
Loading

0 commit comments

Comments
 (0)