You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Template in Blazor File Upload Component | Syncfusion
4
-
description: Checkout and learn here about Template in Syncfusion Blazor File Upload component and much more details.
4
+
description: Learn how to customize the Syncfusion Blazor File Upload component's appearance using templates, including how to add a progress bar.
5
5
platform: Blazor
6
6
control: File Upload
7
7
documentation: ug
8
8
---
9
9
10
10
# Template in Blazor File Upload Component
11
11
12
-
The template feature customizes how each file item is rendered in the uploader UI. It enables full control over layout and styling for file details such as name, size, and status, so the interface can match application design requirements and provide a tailored user experience.
12
+
The Blazor File Upload component allows for the customization of the file list items by using a template. This provides the flexibility to define the structure and styling of individual file elements, such as the file name, size, and status. A custom template can create a tailored and visually appealing file upload interface that aligns with an application's design and user experience requirements.
13
13
14
14
### With server-side API endpoint
15
15
16
-
Use a template with server endpoints when uploads are processed by a backend. The template controls only the display of file items; the upload flow still uses SaveUrl and RemoveUrl.
<div class="e-file-status">File Status : @context.Status</div>
28
+
</div>
29
29
</Template>
30
30
</UploaderTemplates>
31
31
</SfUploader>
32
32
```
33
33
### Without server-side API endpoint
34
34
35
-
Use a template without server endpoints when handling files locally (for example, demos or trusted environments). The template syntax and available context properties are the same as the server-backed example.
36
-
37
35
```cshtml
38
36
@using Syncfusion.Blazor.Inputs
39
37
40
38
<SfUploader ID="Files" AutoUpload="false">
41
39
<UploaderTemplates>
42
-
<Template>
43
-
<div class="name file-name" title="@(context.Name)">File Name : @(context.Name)</div>
When using a custom file template, the built-in progress bar is not shown. The following example disables the default progress indicator (ShowProgressBar=false), renders a custom progress element in the template, and updates it during stream read/write in the ValueChange event. The template displays file name, size, progress, and status, and toggles remove/delete icons based on item state. In browser-only environments (such as WebAssembly), write streams to appropriate storage or a server API; writing directly to the local file system is supported in server/desktop contexts.
55
+
When using a file upload template, the default progress bar is not displayed in the UI. A progress bar can be added within the template, and its progress can be updated by reading and writing to the stream in the `ValueChange` event. The following code snippet demonstrates how to add a progress bar to a Blazor File Upload component using a custom template. The custom template includes elements to display the file name, size, progress bar, and file status.
0 commit comments