How to add overlays to folder/file icons
Hi
When I set the permission in the FileManagerDirectoryContent to read-only FileManager automatically places a padlock on the folder icon.
I extended the FileManagerDirectoryContent class by an IsShared field. When IsShared is true I would like to show a shared overlay icon above the folder/file icon.
I also plan to show more overlays to reflect certain custom file/folder states.
How can I achieve that?
Best regards, Bruno
FileManagerDirectoryContent class with additional properties such as IsShared, IsProtected, and IsArchived in the server like yours.Read operation, we checked the folder names and updated these custom properties accordingly:Documents→IsShared = trueMusic→IsArchived = truePictures→IsProtected = true
LargeIconsTemplate property and conditionally rendered overlay icons based on the custom property values. With this approach, you can display different overlay icons for folders/files depending on their state.NavigationPaneTemplate property of the File Manager. In the sample, overlay icons are rendered in the navigation pane as well, based on the corresponding custom property values. public class FileManagerDirectoryContent { ....... public bool IsShared { get; set; } public bool IsArchived { get; set; } public bool IsProtected { get; set; } } |
[Route("FileOperations")] public object FileOperations([FromBody] FileManagerDirectoryContent args) { ....... switch (args.Action) { case "read": var response = this.operation.GetFiles(args.Path, args.ShowHiddenItems); if (response.Files != null) { var filesList = response.Files.ToList(); for (int i = 0; i < filesList.Count; i++) { var item = filesList[i]; string folderName = item.Name != null ? item.Name.TrimEnd('/') : string.Empty; if (!item.IsFile && (args.Path == "" || args.Path == "/")) { if (folderName.Equals("Documents", StringComparison.OrdinalIgnoreCase)) item.IsShared = true; else if (folderName.Equals("Music", StringComparison.OrdinalIgnoreCase)) item.IsArchived = true; else if (folderName.Equals("Pictures", StringComparison.OrdinalIgnoreCase)) item.IsProtected = true; } } response.Files = filesList; } return this.operation.ToCamelCase(response); } |
<SfFileManager CssClass="e-fm-template-sample" @ref="FileManager" Height="600px" > ..... <LargeIconsTemplate Context="item"> @if (item is not null) { ....... <div class="file-icon-container"> <div class="file-icon background-folder" title="@item.Name"></div> @if (item.IsShared) { <div class="overlay-icon shared-icon" title="Shared"> <span class="e-icons e-link"></span> </div> } @if (item.IsArchived) { <div class="overlay-icon archived-icon" title="Archived"> <span class="e-icons e-save"></span> </div> } @if (item.IsProtected) { <div class="overlay-icon protected-icon" title="Protected"> <span class="e-icons e-lock"></span> </div> } </div> ... } </LargeIconsTemplate> <NavigationPaneTemplate> <div class="e-nav-pane-node" style="display: inline-flex; align-items: center;"> @if (context is FileManagerDirectoryContentExtended item) { <div class="nav-icon-container"> <span class="e-icons nav-folder-icon" style="height:30px;width:30px;"></span> @if (item.IsShared) { <div class="nav-overlay-icon shared-icon" title="Shared"> <span class="e-icons e-link"></span> </div> } @if (item.IsArchived) { <div class="nav-overlay-icon archived-icon" title="Archived"> <span class="e-icons e-save"></span> </div> } @if (item.IsProtected) { <div class="nav-overlay-icon protected-icon" title="Protected"> <span class="e-icons e-lock"></span> </div> } </div> <span class="folder-name" style="margin-left:8px;">@item.Name</span> } </div> </NavigationPaneTemplate> </SfFileManager> <style> .file-icon-container { position: relative; width: 190px; height: 150px; margin-bottom: 10px; } .overlay-icon { position: absolute; bottom: 5px; right: 5px; width: 32px; height: 32px; background-color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); border: 2px solid #ccc; } .shared-icon { background-color: #4CAF50; color: white; border-color: #45a049; } .archived-icon { background-color: #2196F3; color: white; border-color: #0b7dda; } .protected-icon { background-color: #ff9800; color: white; border-color: #e68900; } .overlay-icon span { font-size: 18px; } .shared-icon span { color: white; } .archived-icon span { color: white; } .protected-icon span { color: white; } .e-fm-template-sample .e-nav-pane-node .e-icons { display:inline-block; } .nav-overlay-icon { position: absolute; bottom: 16px; width: 15px; height: 15px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); border: 1px solid #ccc; padding: 0; left: 38px; } </style> |
Regards,
Praveen Sellappan
Attachment: Sample_57a694c2.zip
Hi Praveen
I have implemented the Templates and it works.
But I have a problem with FileManagerContextMenuSettings and the folder icons.
The folder icons show the file menu in the large icon view instead of the folder menu. In the navigation view it's ok.
My LargeIconTemplate is as follows:
<LargeIconsTemplate Context="item"> @if (item is not null) { <div class="so-fm-icon-card"> <div class="so-fm-icon-container"> <div class="so-fm-icon-wrapper"> @if (!item.IsFile) { <IconFolder Size="48" Color="#FDDD35" ColorDark="#FAC800" /> } else { switch (item.Type?.ToLowerInvariant()) { case ".sap": <IconModel Size="48" /> break; case ".sbf": <IconBlockFolder Size="48" /> break; case ".sse": <IconSelection Size="48" /> break; default: <IconFile Size="48" /> break; } } @if (item.IsShared) { <div class="so-fm-overlay-icon so-fm-shared-icon" title="Shared"> <span class="e-icons e-link"></span> </div> } </div> </div> <div class="so-fm-file-name" title="@item.Name">@item.Name</div> </div> } </LargeIconsTemplate>
I implemented special icon components for showing custom svgs.
Any clues why the folder icons show the wrong menu in the large icon view?
I cannot check it with your sample code since it needs an Api.
Regards, Bruno
Hi Bruno,
Based on the information provided, we have validated and classified the reported scenarios regarding the “Incorrect Context Menu on Folder Right-Click in Large Icon View with Custom Templates in File Manager" as a bug on our end. The fix for this issue will be included in the upcoming weekly release scheduled for July 7,2026.
You can track the status of the fix through the following feedback link.
Disclaimer: The provided tentative release timeline is subject to change in the future based on development priorities and testing outcomes.
Regards,
Praveen Sellappan
Hi Praveen
As you can see in my code snipped above I implemented my own file icons in LargeIconsTemplate.
Can you show me how can I change the file icons in the detail view. Is there also special template?
I would also like to set overlay icons for shared and read only files.
Best regards,
Bruno
Hi Bruno,
Thanks for your patience.
We are pleased to inform you that our weekly patch release has been successfully rolled out, and the issue "Incorrect Context Menu on Folder Right-Click in Large Icon View with Custom Templates in File Manager" has been resolved in this release.
Sample: Attached as a zip file.
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
Regards,
Praveen Sellappan
Attachment: BlazorFileManagerSample_311fce95.zip
- 6 Replies
- 2 Participants
-
BR Bruno
- Jun 9, 2026 02:55 PM UTC
- Jul 10, 2026 03:28 PM UTC