FileManager
FileManager is a file explorer bound to your own backend through a provider: a toolbar, a breadcrumb, a tree of the folders, the content in a details, list or grid view, a details pane and a status bar. It lists, creates, renames, deletes, moves, copies, uploads and downloads files with the mouse, drag and drop, a context menu and the keyboard, and hides what the provider does not implement.
Import #
import { FileManager, createMemoryFileProvider, provideFileManagerProvider } from '@exhaustive-ui/core/filemanager';Basic #
FileManager shows the files of a provider, an object with the methods of your backend. createMemoryFileProvider builds one from a tree of files and folders kept in memory, for demos, prototypes and tests: every change is lost on reload. The folder shown is the two-way path, / for the root.
- Home
- Documents
- Music
- Pictures
| Documents | Folder | Dec 4, 2026, 5:21 PM | |
| Music | Folder | Dec 4, 2026, 5:21 PM | |
| Pictures | Folder | Dec 4, 2026, 5:21 PM | |
| archive.zip | 12.2 MB | ZIP file | Jun 30, 2026, 12:00 AM |
| readme.md | 9 B | MD file | Dec 1, 2026, 12:00 AM |
Provider and REST Backend #
FileManager has no backend of its own: it calls the methods of a FileManagerProvider, which you write for your API, cloud storage or file system. Paths start with /, and each method returns a promise. Only list(path) is required; each other method enables a feature, and when it is missing, its buttons, menu items, shortcuts and drops are hidden.
| Method | Enables |
|---|---|
| list(path) | The content of a folder and the tree of the folders. Required. |
| createFolder(parentPath, name) | The New folder button and menu item. |
| rename(item, newName) | Inline rename with F2, the Rename button and menu item. |
| delete(items) | The Delete key, button and menu item. |
| move(items, targetPath) / copy(items, targetPath) | Cut, copy and paste, and drag and drop onto folders. |
| upload(file, targetPath, { signal, onProgress }) | The Upload button and files dropped from the desktop, with their progress. It returns a promise, or an Observable of the progress. |
| download(item) | The Download button and menu item; it gives a URL or a Blob. |
| getThumbnail(item), search(query, path), getDetails(item) | Image thumbnails, the search field and additional facts in the details pane. |
Here is a provider for a REST API with fetch, using an XMLHttpRequest for the progress of the uploads. Adapt the endpoints to yours, or call HttpClient instead. Give it with the provider input, or to every FileManager below an injector with provideFileManagerProvider(), whose factory can inject() services.
import { FileManagerItem, FileManagerProvider, FileManagerUploadOptions } from '@exhaustive-ui/core/filemanager';
/** GET /api/files?path=/Documents -> FileManagerItem[]
* POST /api/folders { parentPath, name } -> FileManagerItem
* PATCH /api/files { path, newName } -> FileManagerItem
* POST /api/files/delete { paths }
* POST /api/files/move { paths, targetPath }
* POST /api/files/copy { paths, targetPath }
* POST /api/files/upload?path=/Documents (multipart, field "file")
* GET /api/files/content?path=/Documents/report.pdf
* GET /api/files/search?path=/&q=report -> FileManagerItem[] */
export class RestFileProvider implements FileManagerProvider {
constructor(private baseUrl = '/api') {}
private async request<T>(url: string, init?: RequestInit): Promise<T> {
const response = await fetch(this.baseUrl + url, { headers: { 'Content-Type': 'application/json' }, ...init });
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
return response.status === 204 ? (undefined as T) : response.json();
}
private post<T>(url: string, body: unknown) {
return this.request<T>(url, { method: 'POST', body: JSON.stringify(body) });
}
list(path: string) {
return this.request<FileManagerItem[]>(`/files?path=${encodeURIComponent(path)}`);
}
createFolder(parentPath: string, name: string) {
return this.post<FileManagerItem>('/folders', { parentPath, name });
}
rename(item: FileManagerItem, newName: string) {
return this.request<FileManagerItem>('/files', { method: 'PATCH', body: JSON.stringify({ path: item.path, newName }) });
}
delete(items: FileManagerItem[]) {
return this.post<void>('/files/delete', { paths: items.map((item) => item.path) });
}
move(items: FileManagerItem[], targetPath: string) {
return this.post<void>('/files/move', { paths: items.map((item) => item.path), targetPath });
}
copy(items: FileManagerItem[], targetPath: string) {
return this.post<void>('/files/copy', { paths: items.map((item) => item.path), targetPath });
}
upload(file: File, targetPath: string, { signal, onProgress }: FileManagerUploadOptions) {
return new Promise<FileManagerItem>((resolve, reject) => {
const xhr = new XMLHttpRequest();
const body = new FormData();
body.append('file', file);
xhr.open('POST', `${this.baseUrl}/files/upload?path=${encodeURIComponent(targetPath)}`);
xhr.upload.onprogress = (event) => onProgress({ loaded: event.loaded, total: event.total || file.size });
xhr.onload = () => (xhr.status < 300 ? resolve(JSON.parse(xhr.responseText)) : reject(new Error(xhr.statusText)));
xhr.onerror = () => reject(new Error('Network error'));
xhr.onabort = () => reject(new DOMException('Upload canceled', 'AbortError'));
signal.addEventListener('abort', () => xhr.abort());
xhr.send(body);
});
}
async download(item: FileManagerItem) {
// A URL is enough when the browser can fetch it with its cookies; return a Blob for a token in a header.
return `${this.baseUrl}/files/content?path=${encodeURIComponent(item.path)}`;
}
search(query: string, path: string) {
return this.request<FileManagerItem[]>(`/files/search?path=${encodeURIComponent(path)}&q=${encodeURIComponent(query)}`);
}
}
// In a component
provider = new RestFileProvider();
// Or for every FileManager of a route or of the application
providers: [provideFileManagerProvider(() => new RestFileProvider(inject(API_URL)))]The demo below uses a provider that only lists and downloads files: the actions that change files are hidden. The readonly input gives the same result with a provider that implements everything.
| Contracts | Folder | Dec 4, 2026, 5:21 PM | |
| handbook.pdf | 2.3 MB | PDF file | Jan 15, 2026, 12:00 AM |
| holidays.ics | 15 B | ICS file | Nov 2, 2026, 12:00 AM |
Views #
The two-way view is details, a table with the name, size, type and modified date of each entry, sortable by clicking a header, list, a compact list, or grid, large icons with the thumbnails of the images. The folders always come first. The sort is the two-way sortField and sortOrder, also set from the toolbar. The two-way preview shows a details pane with a larger thumbnail, the size, the date and the facts given by getDetails for the selected entry.
Thumbnails come from the thumbnail of an entry or from getThumbnail, called for the images shown in the grid view. When a folder has more entries than virtualScrollThreshold, 200 by default, the details view only renders the visible rows. Under the breakpoint width, 640px by default, the view defaults to the list and the tree of the folders opens in a drawer from the toolbar.
- Home
- Logs
- Pictures
Selection #
The selected entries are the two-way selection. A click selects an entry, Ctrl or ⌘ and a click adds or removes one, Shift and a click selects a range, and Ctrl+A selects everything; with the keyboard, the arrow keys move the selection, Shift extends it and Ctrl moves without selecting, then Space selects. selectionMode="single" keeps one selected entry. A double click or Enter opens a folder, and emits onFileOpen for a file, to show it in a viewer or a new tab.
Selected: nothing
Last opened: none
Operations and Events #
Each operation emits an event once the provider has done it: onCreateFolder, onRename, onDelete, onMove, onCopy, onUpload and onDownload, and onError when the provider fails. Before it, a cancelable event (onBeforeCreateFolder, onBeforeRename, onBeforeDelete, onBeforeMove, onBeforeCopy, onBeforeUpload, onBeforeDownload) lets you refuse it with preventDefault(), or replace it with your own dialog and call the methods of the component later, such as deleteNow(items).
A deletion asks for a confirmation in a ConfirmDialog, unless confirmDelete is false. In the demo below, the System folder cannot be deleted or moved; try it with the Delete key or by dragging it into another folder.
- Home
- Projects
- Shared
- System
| Projects | Folder | Dec 4, 2026, 5:21 PM | |
| Shared | Folder | Dec 4, 2026, 5:21 PM | |
| System | Folder | Dec 4, 2026, 5:21 PM | |
| photo.jpg | 402.3 KB | JPG file | Dec 4, 2026, 5:21 PM |
| plan.md | 6 B | MD file | Dec 4, 2026, 5:21 PM |
Upload #
With an upload method, the Upload button opens the file dialog of the browser, filtered by accept, and files dropped from the desktop onto the content or onto a folder are uploaded there. Each file is uploaded in its own call with an AbortSignal, aborted by the cancel button of the status bar, and reports its progress with the onProgress callback; the status bar shows a progress bar per file and a screen reader hears the start, every quarter and the end. onBeforeUpload can refuse files, such as too large ones.
The memory provider of the demo takes two seconds per file, and refuses files over 5 MB.
The upload method can also return an Observable of the progress that completes when the file is stored, such as the events of HttpClient.
upload(file: File, targetPath: string, { signal }: FileManagerUploadOptions) {
const body = new FormData();
body.append('file', file);
return this.http
.post('/api/files/upload', body, { params: { path: targetPath }, reportProgress: true, observe: 'events' })
.pipe(
filter((event) => event.type === HttpEventType.UploadProgress),
map((event) => ({ loaded: event.loaded, total: event.total ?? file.size }))
);
// Unsubscribing, which FileManager does when the user cancels, aborts the request.
}Drag and Drop #
Selected entries can be dragged onto a folder of the content or of the tree to move them, with move, or to copy them while holding Ctrl, Alt or ⌘, with copy. The target folder is highlighted, and a folder cannot go into itself or one of its sub-folders. Files dragged from the desktop are uploaded to the folder they are dropped on, or to the folder shown.
Every drop has a keyboard alternative: Ctrl+X or Ctrl+C puts the selection in the clipboard of the component, then Ctrl+V pastes it in the folder shown, also from the toolbar and the context menu, where Paste on a folder puts the entries into it. Escape empties the clipboard. Moves and copies are announced to screen readers, such as 3 items moved to Projects.
- Home
- Archive
- Inbox
- Projects
Templates #
The itemicon template replaces the icon of the entries, with the entry, the view and its thumbnail; the empty template replaces the message of an empty folder or of a search without results; the preview template replaces the content of the details pane. The icon is decorative: the name of the entry is shown next to it.
Customizing the Toolbar and Menu #
The toolbar template adds buttons after the built-in ones, with the selected entries and the folder shown. The contextMenuItems function receives the default items of the context menu and the entries it acts on, and returns the items to show: add, remove or reorder them. The default items have the ids open, download, cut, copy, paste, rename, delete, newFolder, upload, refresh and selectAll. The buttons and menu items of the features the provider lacks are not there at all.
Every text of the toolbar, the menus, the dialogs and the announcements can be replaced with the labels input, or for the whole application with the fileManager key of the translation, where {0} and {1} are replaced by names and numbers. The units of the sizes come from fileSizeTypes and the dates and numbers follow locale.
// For one FileManager
<p-file-manager [provider]="provider" [labels]="{ root: 'Accueil', newFolder: 'Nouveau dossier', emptyFolder: 'Ce dossier est vide', deletedOne: '« {0} » supprimé' }" locale="fr-FR" />
// For the application
provideExhaustive({
translation: {
fileSizeTypes: ['o', 'Ko', 'Mo', 'Go', 'To'],
fileManager: { root: 'Accueil', newFolder: 'Nouveau dossier', upload: 'Envoyer', delete: 'Supprimer', itemCount: '{0} éléments' }
}
});Accessibility #
Screen Reader
FileManager is a region named File manager, or by ariaLabel or ariaLabelledBy. Its toolbar has the toolbar role and every icon button an accessible name, the view buttons in a group with aria-pressed; the breadcrumb is a navigation landmark named after it, such as Path in File manager, with the current folder marked by aria-current, and the folders are a tree named Folders. Give a distinct name to each FileManager of a page, so that their landmarks can be told apart.
In the details view, the content is a grid named after the folder, such as Content of Documents, with sortable column headers carrying aria-sort, and a row per entry with aria-selected. The list and grid views are a listbox with an option per entry, and aria-multiselectable in the multiple selection mode. The grid or the listbox keeps the focus and points to the active entry with aria-activedescendant, so the focus stays on the right entry after a sort, a rename, a deletion or a paste, and a virtual scroll never loses it.
A polite live region announces the folder opened and its number of entries, the search results, and each operation: Folder "Reports" created, 3 items moved to Archive, "report.pdf" deleted, the start, every quarter and the end of the uploads, and the failures. The inline rename field is named New name for report.pdf and its errors are linked with aria-describedby. Every text is replaceable with labels or the fileManager translation.
<h2 id="files-title">Project files</h2>
<p-file-manager [provider]="provider" ariaLabelledBy="files-title" />
<p-file-manager [provider]="provider" ariaLabel="Gestionnaire de fichiers" [labels]="{ contentLabel: 'Contenu de {0}', renameLabel: 'Nouveau nom de {0}', movedOne: '« {0} » déplacé dans {1}' }" />Keyboard Support
The toolbar, the breadcrumb, the tree and the content follow each other in the tab order. In the toolbar, the left and right arrows also move between the buttons.
| Key | Function |
|---|---|
| up arrow / down arrow | Selects the previous or the next entry; in the grid view, the entry above or below. |
| left arrow / right arrow | In the grid view, selects the previous or the next entry. |
| home / end / page up / page down | Selects the first or the last entry, or moves by ten entries. |
| shift + arrow keys | Extends the selection. |
| ctrl + arrow keys, then ctrl + space | Moves without changing the selection, then adds or removes the entry. |
| ctrl + a | Selects all the entries. |
| enter | Opens a folder, or emits onFileOpen for a file. |
| backspace / alt + up arrow | Opens the parent folder, or leaves the search results. |
| alt + left arrow / alt + right arrow | Goes back or forward in the history of the folders. |
| f2 | Renames the active entry; enter applies the new name and escape cancels. |
| delete | Deletes the selected entries, after a confirmation. |
| ctrl + x / ctrl + c / ctrl + v | Cuts or copies the selected entries, and pastes them in the folder shown: the keyboard alternative to drag and drop. |
| shift + f10 / context menu | Opens the context menu of the selection, or of the folder when nothing is selected. |
| escape | Empties the clipboard, then clears the selection. |
| any character | Selects the next entry whose name starts with the typed characters. |











