TelerikFileSelect
A component that lets you select files via dialog or drag-and-drop without uploading. Supports preloaded files, selection and removal events (with cancellation), validation (extensions, min/max size), multiple selection, keyboard navigation, and integration with drop zones.
Definition
Namespace:Telerik.Blazor.Components
Assembly:Telerik.Blazor.dll
Syntax:
public class TelerikFileSelect : TelerikUploadBase<FileSelectFileInfo, FileSelectFileTemplateContext, FileSelectFileInfoTemplateContext>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Inheritance: objectComponentBaseBaseComponentTelerikUploadBase<FileSelectFileInfo, FileSelectFileTemplateContext, FileSelectFileInfoTemplateContext>TelerikFileSelect
Implements:
Inherited Members
Constructors
public TelerikFileSelect()
Properties
[CascadingParameter(Name = "DropZoneClass")]
public string DropZoneClass { get; set; }
Files
IEnumerable<FileSelectFileInfo>
Preloads a collection of files to display in the FileSelect component during initialization. Use to show previously selected files, restore user sessions, or display files from server storage. Files appear in the file list as if they were selected by the user, supporting standard interactions like removal. INITIALIZATION: Files are loaded once during component initialization and become part of the current selection. RESTORATION: Essential for maintaining file selection state across page navigation or application restarts.
[Parameter]
public IEnumerable<FileSelectFileInfo> Files { get; set; }
Fires before a file is removed from the selection list, allowing validation and cancellation of the removal action. Use this event to confirm file removal, clean up resources, or prevent accidental deletion of important files. Event provides access to the file being removed with all its metadata and current state information. CANCELLATION: Set IsCancelled to true to prevent the file from being removed. CLEANUP: Ideal for disposing file streams, clearing temporary data, or updating related UI state.
[Parameter]
public EventCallback<FileSelectEventArgs> OnRemove { get; set; }
Fires when users select one or more files through the file dialog or drag-and-drop interaction. Use this event to handle file validation, preview generation, data processing, or custom upload logic. Event provides access to selected files with metadata including name, size, extension, and content stream. CANCELLATION: Set IsCancelled to true to prevent files from being added to the file list. ASYNC: Supports asynchronous operations for file processing, validation, or server communication.
[Parameter]
public EventCallback<FileSelectEventArgs> OnSelect { get; set; }
[CascadingParameter(Name = "RenderAsHiddenInput")]
public bool RenderAsHiddenInput { get; set; }
[CascadingParameter(Name = "ShowFileList")]
public bool ShowFileList { get; set; }
Methods
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Overrides:
protected override void OnInitialized()
Overrides:
Removes the file with the specified identifier from the collection.
public void RemoveFile(string fileId)
The unique identifier of the file to remove.