formaui-net.Blazor.Explorer 1.0.0-preview.27

Prefix Reserved
This is a prerelease version of formaui-net.Blazor.Explorer.
dotnet add package formaui-net.Blazor.Explorer --version 1.0.0-preview.27
                    
NuGet\Install-Package formaui-net.Blazor.Explorer -Version 1.0.0-preview.27
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="formaui-net.Blazor.Explorer" Version="1.0.0-preview.27" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="formaui-net.Blazor.Explorer" Version="1.0.0-preview.27" />
                    
Directory.Packages.props
<PackageReference Include="formaui-net.Blazor.Explorer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add formaui-net.Blazor.Explorer --version 1.0.0-preview.27
                    
#r "nuget: formaui-net.Blazor.Explorer, 1.0.0-preview.27"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package formaui-net.Blazor.Explorer@1.0.0-preview.27
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=formaui-net.Blazor.Explorer&version=1.0.0-preview.27&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=formaui-net.Blazor.Explorer&version=1.0.0-preview.27&prerelease
                    
Install as a Cake Tool

Forma.Blazor.Explorer

FormaExplorer, a file manager for the Forma component library over items and folders the host already holds: a folder tree, an address bar with history and breadcrumbs, thumbnail, details and list views, search, sorting and grouping, selection, drag and drop between folders, upload, and a preview of any item. The host supplies the items and carries out each change the reader asks for, and uploads go into the host's IFileStore.

.NET 11 · Blazor components.

Install

dotnet add package formaui-net.Blazor.Explorer --prerelease
dotnet add package formaui-net.Framework.Localization.Json --prerelease

The package depends on formaui-net.Blazor and formaui-net.Framework.Catalog, which restore beside it. The component is in the Forma.Blazor.Components.Explorer namespace; the items, provider and requests it works with are Forma.Framework.Catalog's, and its options are Forma.Framework.Explorer's, which comes with this package.

Register

AddFormaServerIntegration() registers what the component needs. Register an IFileStore for uploads, and list the component's assembly beside the library's when mapping components:

using Forma.Blazor;
using Forma.Framework.Localization.Json;
using Forma.Framework.Resources;

builder.Services.AddRazorComponents()
    .AddInteractiveServerComponents();
builder.Services.AddJsonLocalization();
builder.AddFormaServerIntegration();
builder.Services.AddScoped<IFileStore, MediaFileStore>();

var app = builder.Build();

app.MapRazorComponents<App>()
    .AddInteractiveServerRenderMode()
    .AddAdditionalAssemblies(
        typeof(Forma.Blazor._Imports).Assembly,
        typeof(Forma.Blazor.Components.Explorer._Imports).Assembly);

The Store parameter takes a store for one explorer in place of the registered one. An explorer without a store sets AllowUpload to false in its ItemOptions. The preview is FormaFileViewer, so any IResourceProvider the host registers applies to it too; both contracts are described in Forma.Framework.Resources.

Use

A page hands the explorer the items of the folder it is showing, the folders for the tree, and a handler for each change it carries out:

@page "/media"
@rendermode InteractiveServer
@using Forma.Blazor.Components.Explorer
@using Forma.Framework.Catalog
@using Forma.Framework.Catalog.Requests
@inject IMediaLibrary Library

<FormaExplorer Items="_items"
               Folders="_folders"
               CurrentFolder="_currentFolder"
               OnFolderChanged="HandleFolderChangedAsync"
               OnRename="HandleRenameAsync"
               OnDelete="HandleDeleteAsync"
               OnDrop="HandleDropAsync"
               OnUploaded="_ => LoadAsync()"
               @bind-Selected="_selected" />

@code {
    private IReadOnlyList<ICatalogItem> _items = [];
    private IReadOnlyList<ICatalogItem> _folders = [];
    private IReadOnlyList<ICatalogItem> _selected = [];
    private ICatalogFolderItem? _currentFolder;

    protected override Task OnInitializedAsync()
        => LoadAsync();

    private async Task LoadAsync()
    {
        _folders = CatalogItem.ForAll(await Library.GetFoldersAsync());
        _items = CatalogItem.ForAll(await Library.GetFilesAsync(_currentFolder?.Key));
    }

    private Task HandleFolderChangedAsync(ICatalogFolderItem? folder)
    {
        _currentFolder = folder;

        return LoadAsync();
    }

    private async Task HandleRenameAsync(CatalogRenameRequest request)
    {
        await Library.RenameAsync(request.Item.Key, request.NewName);
        await LoadAsync();
    }

    private async Task HandleDeleteAsync(CatalogDeleteRequest request)
    {
        await Library.DeleteAsync(request.Items.Select(item => item.Key));
        await LoadAsync();
    }

    private async Task HandleDropAsync(CatalogDropRequest request)
    {
        await Library.MoveAsync(request.Items.Select(item => item.Key), request.TargetFolder?.Key);
        await LoadAsync();
    }
}

CatalogItem.ForAll wraps the host's ResourceInfo records as items, a FolderResourceInfo becoming a folder placed in the tree by its Parent. A host's own entities can implement ICatalogItem and ICatalogFolderItem instead.

Items or a provider

Exactly one of two parameters supplies the items:

Parameter What it takes Suits
Items The whole collection, which the explorer searches, sorts and pages itself. A few hundred items.
ItemsProvider An ICatalogProvider answering one slice at a time. A library too large to hold.

With a provider, TotalCount and TotalBytes give the size of the whole library, which the constraints are measured against, and the explorer reads its items again after a rename, deletion, drop or upload. The explorer asks the provider for files alone, through the query's Kinds, and lists the Folders the host gives before them. _provider below is an ICatalogProvider such as the one the catalog's README writes:

@using Forma.Framework.Explorer
@using Forma.Framework.Explorer.Content.Queries

<FormaExplorer ItemsProvider="_provider"
               Folders="_folders"
               CurrentFolder="_currentFolder"
               TotalCount="_libraryCount"
               PageSize="48"
               Options="@(ExplorerOptions.Default with { InfiniteScroll = ExplorerInfiniteScrollMode.Automatic })"
               OnFolderChanged="folder => _currentFolder = folder" />

Callbacks

Every callback carries the items the host supplied. The host carries the request out and supplies the items again. A deletion, a drop and a rename take files and folders alike, a folder told apart by ICatalogFolderItem, and a host that could not carry one out calls its Fail(), which keeps the selection as it was.

Callback Carries Raised when
OnFolderChanged ICatalogFolderItem? The reader navigates; null is the root. The explorer follows the move itself, and a host that binds CurrentFolder sets it to the folder.
OnFileActivated ICatalogItem A file is activated, by a press or Enter, in place of opening its preview.
OnRename CatalogRenameRequest A rename of a file or a folder is confirmed.
OnDelete CatalogDeleteRequest A deletion of one item or the selection, files and folders together, is confirmed.
OnDrop CatalogDropRequest Items, files and folders together, land on a folder, or on the root.
OnFolderCreate CatalogFolderCreateRequest A new folder is confirmed.
OnUploaded IReadOnlyList<ResourceInfo> The store has taken the uploaded files.
OnRejected CatalogRejection A constraint refused an upload, a folder or a drop, or an item may not be deleted or moved.
OnRefresh — The refresh action is pressed.
SelectedChanged IReadOnlyList<ICatalogItem> The selection changes; @bind-Selected pairs it with Selected.
OnPageChanged int The page changes; pairs with CurrentPage.
ViewModeChanged, GroupFieldChanged, DetailsColumnsChanged, DetailsHeaderVisibleChanged The new value The reader changes the presentation.

Configuring

ViewMode opens the explorer in Thumbnails, Details or List. SortField and SortDirection set the order, by Name, Size, Kind, DateAdded or DateModified, and GroupField gathers the items under collapsible headings by the same fields. PageSize sets the page, and SearchPlaceholder the search box's text.

A thumbnail draws an item's ThumbnailSource, or an image's own source, only where an image allows the address, and a video's first frame only where a video allows its source, as Forma.Framework.Sanitization sets out. An item at any other address, javascript: among them, draws its kind's glyph, and the log records the refusal at Debug under FormaExplorerThumbnail.

Options is an ExplorerOptions:

Option What it does
ShowSidebar Shows the folder tree.
ShowFolderMenu Gives each breadcrumb a menu of that folder's children.
Resizable Lets the reader resize the explorer.
AsDialog Presents the explorer as dialog content.
SelectOnOpen Makes the explorer a picker, opening in selection mode and staying in it. A picker keeps its choices as the reader moves between folders, and its count opens them for review, each with the folder it stands in and a way to remove it; where the accepted kinds name folders, it offers Choose This Folder inside a folder.
MaxSelection Caps the selection; zero is unlimited, and one makes each choice replace the last.
InfiniteScroll Off pages; Manual appends the next page from a button, and Automatic as the reader reaches the end.
DetailsColumns, ShowDetailsHeader The details view's opening columns, of Kind, Size, Modified and Added, and its header.
SearchDebounceDelay How long typing pauses before a provider is asked.

ItemOptions is an ExplorerItemOptions of the operations permitted: AllowedCapabilities on items, AllowedFolderCapabilities on folders, and AllowUpload. An item offers an operation when it supports it and the options permit it. ExplorerItemOptions.Default permits every operation, and ExplorerItemOptions.ReadOnly permits browsing and selection.

Constraints is a CatalogConstraints of the kinds the explorer lists and accepts, the kinds an upload may add where they differ, and the ceilings it keeps, each unlimited at zero but MaxFileBytes: an upload reads a file up to it, and up to FileUploaderOptions.MaxFileSize, 10 MiB, where it is zero, so a larger file is refused as it is picked. A refusal is announced in the explorer and raised through OnRejected. A folder can be chosen only where the accepted kinds name it, contentType:image;folder, and is entered otherwise, so an explorer that chooses images lets the reader into every folder to reach them:

<FormaExplorer Items="_items"
               Constraints="@(new CatalogConstraints { AcceptedResourceKinds = "contentType:image;video", MaxFolderDepth = 3 })"
               OnRejected="rejection => _message = rejection.Message" />

License

Apache License 2.0, under the repository's LICENSE.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on formaui-net.Blazor.Explorer:

Package Downloads
formaui-net.AddOns.Composer.Plugins.Explorer

A FormaComposer plugin that lets an author pick one of the host's stored files and insert it.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-preview.27 42 12/3/2026
1.0.0-preview.26 49 12/3/2026
1.0.0-preview.25 52 12/2/2026
1.0.0-preview.24 54 12/1/2026
1.0.0-preview.23 68 11/30/2026
1.0.0-preview.22 65 11/30/2026
1.0.0-preview.21 72 11/29/2026
1.0.0-preview.20 90 11/26/2026
1.0.0-preview.19 70 11/26/2026
1.0.0-preview.18 76 11/26/2026
1.0.0-preview.17 66 11/26/2026
1.0.0-preview.16 63 11/24/2026
1.0.0-preview.15 63 11/23/2026
1.0.0-preview.14 60 11/23/2026
1.0.0-preview.13 64 11/21/2026
1.0.0-preview.12 71 11/20/2026
1.0.0-preview.11 66 11/18/2026
1.0.0-preview.10 74 11/17/2026
1.0.0-preview.9 96 11/17/2026
1.0.0-preview.8 73 11/17/2026
Loading failed

What this release changed is in Forma's changelog: https://github.com/FormaUI/Forma/blob/v1.0.0-preview.27/CHANGELOG.md