Adding HTML Attributes in Blazor File Upload Component

18 Mar 20241 minute to read

You can add the additional HTML attributes such as disabled, value, name, and more to the element using the HtmlAttributes property. If you configure both the property and equivalent HTML attribute, then the component will consider the property value.

The following example demonstrates how to set attributes in the HtmlAttributes property in the Uploader.

@using Syncfusion.Blazor.Inputs

<SfUploader  HtmlAttributes="@htmlattribute">
    <UploaderAsyncSettings SaveUrl="https://blazor.syncfusion.com/services/production/api/FileUploader/Save" RemoveUrl="https://blazor.syncfusion.com/services/production/api/FileUploader/Remove"></UploaderAsyncSettings>
</SfUploader>

@code{

    Dictionary<string, object> htmlattribute = new Dictionary<string, object>()
        {
           { "name", "file-uploader" },
           {"disabled","true" }
        };
}