# Angular FileManager Component

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.

## 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.

```typescript
import { Component, signal } from '@angular/core';
import { createMemoryFileProvider, FileManagerModule } from '@exhaustive-ui/core/filemanager';

@Component({
    template: `
        <div class="card flex flex-col gap-3">
            <p-file-manager [provider]="provider" [(path)]="path" ariaLabel="My files" />
            <span class="text-sm text-surface-600 dark:text-surface-400">Path: {{ path() }}</span>
        </div>
    `,
    standalone: true,
    imports: [FileManagerModule]
})
export class FilemanagerBasicDemo {
    path = signal('/');

    provider = createMemoryFileProvider([
        {
            name: 'Documents',
            children: [
                { name: 'Invoices', children: [{ name: 'invoice-2026-11.pdf', size: 84_210, modified: '2026-11-30' }] },
                { name: 'report.pdf', size: 1_254_000, modified: '2026-10-14' },
                { name: 'budget.xlsx', size: 42_800, modified: '2026-09-02' },
                { name: 'notes.txt', content: 'Call the printer on Monday.', modified: '2026-11-21' }
            ]
        },
        {
            name: 'Pictures',
            children: [
                { name: 'mountain.jpg', size: 320_400, thumbnail: '/demo/galleria/galleria1s.jpg', modified: '2026-08-12' },
                { name: 'lake.jpg', size: 298_000, thumbnail: '/demo/galleria/galleria2s.jpg', modified: '2026-08-13' }
            ]
        },
        { name: 'Music', children: [] },
        { name: 'readme.md', content: '# Welcome', modified: '2026-12-01' },
        { name: 'archive.zip', size: 12_800_000, modified: '2026-06-30' }
    ]);
}
```

## 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. 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.

```typescript
import { Component } from '@angular/core';
import { createMemoryFileProvider, FileManagerModule, FileManagerProvider } from '@exhaustive-ui/core/filemanager';

@Component({
    template: `
        <div class="card">
            <p-file-manager [provider]="readOnlyProvider" [showTree]="false" ariaLabel="Shared documents" />
        </div>
    `,
    standalone: true,
    imports: [FileManagerModule]
})
export class FilemanagerProviderDemo {
    private memory = createMemoryFileProvider([
        { name: 'Contracts', children: [{ name: 'lease.pdf', size: 210_000, modified: '2026-03-01' }] },
        { name: 'handbook.pdf', size: 2_400_000, modified: '2026-01-15' },
        { name: 'holidays.ics', content: 'BEGIN:VCALENDAR', modified: '2026-11-02' }
    ]);

    readOnlyProvider: FileManagerProvider = {
        list: (path) => this.memory.list(path),
        download: (item) => this.memory.download!(item)
    };
}
```

## 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.

```typescript
import { Component, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { createMemoryFileProvider, FileManagerMemoryNode, FileManagerModule, FileManagerView } from '@exhaustive-ui/core/filemanager';
import { SelectButtonModule } from '@exhaustive-ui/core/selectbutton';

@Component({
    template: `
        <div class="card flex flex-col gap-4">
            <p-select-button [options]="views" [(ngModel)]="view" optionLabel="label" optionValue="value" [allowEmpty]="false" ariaLabelledBy="views-label" />
            <span id="views-label" class="sr-only">View</span>
            <p-file-manager [provider]="provider" [(view)]="view" [(preview)]="preview" path="/Pictures" ariaLabel="Photos" />
        </div>
    `,
    standalone: true,
    imports: [FileManagerModule, SelectButtonModule, FormsModule]
})
export class FilemanagerViewsDemo {
    view = signal<FileManagerView | undefined>('grid');

    preview = signal(true);

    views = [
        { label: 'Details', value: 'details' },
        { label: 'List', value: 'list' },
        { label: 'Grid', value: 'grid' }
    ];

    pictures: FileManagerMemoryNode[] = Array.from({ length: 12 }, (_, index) => ({
        name: `photo-${String(index + 1).padStart(2, '0')}.jpg`,
        size: 180_000 + index * 23_000,
        modified: new Date(2026, 7, index + 1),
        thumbnail: `/demo/galleria/galleria${index + 1}s.jpg`,
        details: [
            { label: 'Camera', value: 'X-T5' },
            { label: 'Dimensions', value: '4000 × 3000' }
        ]
    }));

    provider = createMemoryFileProvider([
        { name: 'Pictures', children: [{ name: 'Holidays', children: [] }, ...this.pictures] },
        { name: 'Logs', children: Array.from({ length: 1000 }, (_, index) => ({ name: `log-${index + 1}.txt`, size: 1_000 + index, modified: new Date(2026, 0, 1 + (index % 300)) })) },
        { name: 'todo.txt', content: 'Sort the photos' }
    ]);
}
```

## 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.

```typescript
import { Component, computed, signal } from '@angular/core';
import { createMemoryFileProvider, FileManagerFileOpenEvent, FileManagerItem, FileManagerModule } from '@exhaustive-ui/core/filemanager';

@Component({
    template: `
        <div class="card flex flex-col gap-3">
            <p-file-manager [provider]="provider" [(selection)]="selection" (onFileOpen)="open($event)" view="list" [showTree]="false" ariaLabel="Meeting files" />
            <p class="m-0 text-sm text-surface-600 dark:text-surface-400">Selected: {{ names() || 'nothing' }}</p>
            <p class="m-0 text-sm text-surface-600 dark:text-surface-400">Last opened: {{ opened() || 'none' }}</p>
        </div>
    `,
    standalone: true,
    imports: [FileManagerModule]
})
export class FilemanagerSelectionDemo {
    selection = signal<FileManagerItem[]>([]);

    opened = signal('');

    names = computed(() =>
        this.selection()
            .map((item) => item.name)
            .join(', ')
    );

    provider = createMemoryFileProvider([
        { name: 'Drafts', children: [{ name: 'letter.docx', size: 24_000 }] },
        { name: 'agenda.pdf', size: 88_000, modified: '2026-11-28' },
        { name: 'minutes.pdf', size: 64_000, modified: '2026-11-21' },
        { name: 'slides.pptx', size: 3_400_000, modified: '2026-11-18' },
        { name: 'speakers.csv', size: 2_100, modified: '2026-11-15' }
    ]);

    open(event: FileManagerFileOpenEvent) {
        this.opened.set(event.item.path);
    }
}
```

## 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.

```typescript
import { Component, signal } from '@angular/core';
import { createMemoryFileProvider, FileManagerBeforeEvent, FileManagerDeleteEvent, FileManagerErrorEvent, FileManagerModule, FileManagerTransferEvent } from '@exhaustive-ui/core/filemanager';

@Component({
    template: `
        <div class="card flex flex-col gap-3">
            <p-file-manager
                [provider]="provider"
                ariaLabel="Workspace"
                (onBeforeDelete)="protect($event)"
                (onBeforeMove)="protect($event)"
                (onDelete)="log('Deleted ' + names($event))"
                (onMove)="log('Moved ' + names($event) + ' to ' + $event.targetPath)"
                (onCopy)="log('Copied ' + names($event) + ' to ' + $event.targetPath)"
                (onRename)="log('Renamed ' + $event.item.name + ' to ' + $event.newName)"
                (onCreateFolder)="log('Created ' + $event.name)"
                (onError)="error($event)"
            />
            <ol class="m-0 ps-6 text-sm flex flex-col gap-1" aria-label="Events">
                @for (entry of events(); track $index) {
                    <li>{{ entry }}</li>
                }
            </ol>
        </div>
    `,
    standalone: true,
    imports: [FileManagerModule]
})
export class FilemanagerOperationsDemo {
    events = signal<string[]>([]);

    provider = createMemoryFileProvider([
        { name: 'System', children: [{ name: 'config.json', content: '{}' }] },
        { name: 'Projects', children: [{ name: 'Website', children: [] }] },
        { name: 'Shared', children: [] },
        { name: 'plan.md', content: '# Plan' },
        { name: 'photo.jpg', size: 412_000 }
    ]);

    protect(event: (FileManagerDeleteEvent | FileManagerTransferEvent) & FileManagerBeforeEvent) {
        if (event.items.some((item) => item.path === '/System')) {
            event.preventDefault();
            this.log('The System folder is protected');
        }
    }

    names(event: { items: { name: string }[] }) {
        return event.items.map((item) => item.name).join(', ');
    }

    error(event: FileManagerErrorEvent) {
        this.log(`${event.operation} failed: ${(event.error as Error)?.message ?? event.error}`);
    }

    log(text: string) {
        this.events.update((events) => [text, ...events].slice(0, 6));
    }
}
```

## 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 .

```typescript
import { Component } from '@angular/core';
import { createMemoryFileProvider, FileManagerModule, FileManagerUploadEvent, FileManagerBeforeEvent } from '@exhaustive-ui/core/filemanager';

@Component({
    template: `
        <div class="card">
            <p-file-manager [provider]="provider" accept="image/*,.pdf,.txt,.md" (onBeforeUpload)="checkSize($event)" view="list" [showTree]="false" ariaLabel="Uploads" />
        </div>
    `,
    standalone: true,
    imports: [FileManagerModule]
})
export class FilemanagerUploadDemo {
    provider = createMemoryFileProvider(
        [
            { name: 'Uploads', children: [] },
            { name: 'existing.pdf', size: 120_000 }
        ],
        { latency: 2000 }
    );

    checkSize(event: FileManagerUploadEvent & FileManagerBeforeEvent) {
        if (event.files.some((file) => file.size > 5 * 1024 * 1024)) event.preventDefault();
    }
}
```

## 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 .

```typescript
import { Component } from '@angular/core';
import { createMemoryFileProvider, FileManagerModule } from '@exhaustive-ui/core/filemanager';

@Component({
    template: `
        <div class="card">
            <p-file-manager [provider]="provider" view="grid" ariaLabel="Projects" />
        </div>
    `,
    standalone: true,
    imports: [FileManagerModule]
})
export class FilemanagerDragdropDemo {
    provider = createMemoryFileProvider([
        { name: 'Inbox', children: [] },
        { name: 'Projects', children: [{ name: 'Website', children: [] }] },
        { name: 'Archive', children: [] },
        { name: 'brief.pdf', size: 240_000 },
        { name: 'mockup.png', size: 812_000, thumbnail: '/demo/galleria/galleria3s.jpg' },
        { name: 'quote.xlsx', size: 31_000 },
        { name: 'notes.md', content: '# Notes' }
    ]);
}
```

## 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.

```typescript
import { Component } from '@angular/core';
import { createMemoryFileProvider, FileManagerModule } from '@exhaustive-ui/core/filemanager';
import { SvgIcon } from '@exhaustive-ui/core/icon';
import { folder, inbox } from '@exhaustive-ui/icons/round';

@Component({
    template: `
        <div class="card">
            <p-file-manager [provider]="provider" view="list" [showTree]="false" ariaLabel="Code files">
                <ng-template #itemicon let-item let-view="view">
                    @if (item.type === 'folder') {
                        <svg pIcon [icon]="folder" class="text-yellow-600 dark:text-yellow-400" [class.text-4xl]="view === 'grid'"></svg>
                    } @else {
                        <span class="inline-flex items-center justify-center rounded px-1 text-[0.625rem] font-bold uppercase bg-primary text-primary-contrast" style="min-width: 2.25rem">{{ extension(item.name) }}</span>
                    }
                </ng-template>
                <ng-template #empty let-path let-query="query">
                    <div class="flex flex-col items-center gap-2">
                        <svg pIcon [icon]="inbox" class="text-3xl"></svg>
                        <span>{{ query ? 'Nothing found for ' + query : 'Nothing in ' + path + ' yet. Drop files here.' }}</span>
                    </div>
                </ng-template>
            </p-file-manager>
        </div>
    `,
    standalone: true,
    imports: [SvgIcon, FileManagerModule]
})
export class FilemanagerTemplateDemo {
    folder = folder;
    inbox = inbox;

    provider = createMemoryFileProvider([
        { name: 'Empty folder', children: [] },
        { name: 'design.fig', size: 2_400_000 },
        { name: 'logo.svg', size: 4_200 },
        { name: 'style.css', size: 18_000 },
        { name: 'data.json', size: 920 }
    ]);

    extension(name: string) {
        return name.includes('.') ? name.split('.').pop() : 'file';
    }
}
```

## 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 .

```typescript
import { Component, signal } from '@angular/core';
import { MenuItem } from '@exhaustive-ui/core/api';
import { ButtonModule } from '@exhaustive-ui/core/button';
import { createMemoryFileProvider, FileManagerContextMenuContext, FileManagerItem, FileManagerModule } from '@exhaustive-ui/core/filemanager';
import { SvgIcon } from '@exhaustive-ui/core/icon';
import { shareAlt } from '@exhaustive-ui/icons/round';

@Component({
    template: `
        <div class="card flex flex-col gap-3">
            <p-file-manager [provider]="provider" [contextMenuItems]="menuItems" [showTree]="false" view="list" ariaLabel="Team files">
                <ng-template #toolbar let-selection let-path="path">
                    <p-button label="Share" [text]="true" severity="secondary" size="small" [disabled]="!selection.length" (onClick)="share(selection)">
                        <ng-template #icon><svg pIcon [icon]="shareAlt"></svg></ng-template>
                    </p-button>
                </ng-template>
            </p-file-manager>
            <p class="m-0 text-sm text-surface-600 dark:text-surface-400" aria-live="polite">{{ message() }}</p>
        </div>
    `,
    standalone: true,
    imports: [SvgIcon, FileManagerModule, ButtonModule]
})
export class FilemanagerToolbarDemo {
    shareAlt = shareAlt;

    message = signal('');

    provider = createMemoryFileProvider([
        { name: 'Team', children: [{ name: 'roadmap.pdf', size: 340_000 }] },
        { name: 'invoice.pdf', size: 92_000 },
        { name: 'logo.png', size: 48_000 },
        { name: 'contract.docx', size: 61_000 }
    ]);

    menuItems = (items: MenuItem[], context: FileManagerContextMenuContext): MenuItem[] => {
        const withoutDownload = items.filter((item) => item.id !== 'download');
        if (!context.items.length) return withoutDownload;
        return [{ id: 'share', label: 'Share', command: () => this.share(context.items) }, { separator: true }, ...withoutDownload];
    };

    share(items: FileManagerItem[]) {
        this.message.set(`Share link created for ${items.map((item) => item.name).join(', ')}`);
    }
}
```

## 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.

## File Manager

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.

### Props

| Name | Type | Default | Description |
|------|------|---------|-------------|
| dt | Object | undefined | Defines scoped design tokens of the component. |
| unstyled | boolean | undefined | Indicates whether the component should be rendered without styles. |
| pt | FileManagerPassThrough | undefined | Used to pass attributes to DOM elements inside the component. |
| ptOptions | PassThroughOptions | undefined | Used to configure passthrough(pt) options of the component. |
| provider | FileManagerProvider | - | The adapter to the backend. Only  `list`  is required; each other method enables its feature. The  `FILEMANAGER_PROVIDER`  token, set with  `provideFileManagerProvider()` , is used when not set. |
| path | string | '/' | Folder shown, two-way bound with  `[(path)]` . |
| selection | FileManagerItem[] | [] | Selected entries, two-way bound with  `[(selection)]` . |
| view | FileManagerView | - | Layout of the content, two-way bound with  `[(view)]` :  `details`  on wide screens and  `list`  on small ones when not set. |
| sortField | FileManagerSortField | 'name' | Column the entries are sorted by, two-way bound; the folders always come first. |
| sortOrder | -1 \| 1 | 1 | Sort order, 1 ascending or -1 descending, two-way bound. |
| preview | boolean | false | Whether the details pane is shown, two-way bound. |
| selectionMode | "multiple" \| "single" | 'multiple' | Whether one or several entries can be selected. |
| showTree | boolean | true | Whether the tree of the folders is shown, next to the content or in a drawer on small screens. |
| readonly | boolean | false | Whether nothing can be changed: the actions that change files are hidden whatever the provider implements. |
| confirmDelete | boolean | true | Whether a deletion asks for a confirmation. |
| breakpoint | number | 640 | Width of the component in pixels under which the tree goes into a drawer, the details pane is hidden and the default view is  `list` . |
| panelSizes | number[] | [25, 75] | Sizes in percent of the tree and the content. |
| virtualScrollThreshold | number | 200 | Number of entries from which the details view renders only the visible rows. |
| accept | string | - | File types the upload dialog offers, such as  `image/*,.pdf` . |
| locale | string | - | Locale of the dates and the numbers; the locale of the browser when not set. |
| contextMenuItems | FileManagerContextMenuItems | - | Builds the items of the context menu from the default ones, to add, remove or change items. The default items have the ids  `open` ,  `download` ,  `cut` ,  `copy` ,  `paste` ,  `rename` ,  `delete` ,  `newFolder` ,  `upload` ,  `refresh`  and  `selectAll` . |
| ariaLabel | string | - | Accessible name of the component; the ariaLabel text when not set. |
| ariaLabelledBy | string | - | Identifier of the element that labels the component. |
| labels | Partial<FileManagerLabels> | - | Texts of the component, merged with the  `fileManager`  translation and the English defaults. |

### Emits

| Name | Parameters | Description |
|------|------------|-------------|
| onNavigate | event: FileManagerNavigateEvent | Callback to invoke when another folder is shown. |
| onFileOpen | event: FileManagerFileOpenEvent | Callback to invoke when a file is opened with a double click, Enter or the Open menu item. |
| onBeforeCreateFolder | event: FileManagerCreateFolderEvent & FileManagerBeforeEvent | Callback to invoke before a folder is created;  `preventDefault()`  cancels it. |
| onCreateFolder | event: FileManagerCreateFolderEvent | Callback to invoke when a folder is created. |
| onBeforeRename | event: FileManagerRenameEvent & FileManagerBeforeEvent | Callback to invoke before a rename;  `preventDefault()`  cancels it. |
| onRename | event: FileManagerRenameEvent | Callback to invoke after a rename. |
| onBeforeDelete | event: FileManagerDeleteEvent & FileManagerBeforeEvent | Callback to invoke before a deletion, before the confirmation;  `preventDefault()`  cancels it, to ask in your own way and call  `delete()`  later. |
| onDelete | event: FileManagerDeleteEvent | Callback to invoke after a deletion. |
| onBeforeMove | event: FileManagerTransferEvent & FileManagerBeforeEvent | Callback to invoke before a move;  `preventDefault()`  cancels it. |
| onMove | event: FileManagerTransferEvent | Callback to invoke after a move. |
| onBeforeCopy | event: FileManagerTransferEvent & FileManagerBeforeEvent | Callback to invoke before a copy;  `preventDefault()`  cancels it. |
| onCopy | event: FileManagerTransferEvent | Callback to invoke after a copy. |
| onBeforeUpload | event: FileManagerUploadEvent & FileManagerBeforeEvent | Callback to invoke before files are uploaded;  `preventDefault()`  cancels them. |
| onUpload | event: FileManagerUploadCompleteEvent | Callback to invoke when a file is uploaded. |
| onBeforeDownload | event: FileManagerDownloadEvent & FileManagerBeforeEvent | Callback to invoke before a download;  `preventDefault()`  cancels it. |
| onDownload | event: FileManagerDownloadEvent | Callback to invoke after the content of a file is given to the browser. |
| onError | event: FileManagerErrorEvent | Callback to invoke when the provider fails. |

### Templates

| Name | Type | Description |
|------|------|-------------|
| itemicon | TemplateRef<FileManagerItemIconTemplateContext> | Custom icon or thumbnail of the entries. |
| empty | TemplateRef<FileManagerEmptyTemplateContext> | Custom content of an empty folder or a search without results. |
| toolbar | TemplateRef<FileManagerToolbarTemplateContext> | Additional buttons of the toolbar, after the built-in ones. |
| preview | TemplateRef<FileManagerPreviewTemplateContext> | Custom content of the details pane. |

### Methods

| Name | Parameters | Return Type | Description |
|------|------------|-------------|-------------|
| refresh |  | void | Loads the folder shown again, and the folders of the tree already loaded. |
| navigate | path: string | void | Shows a folder. |
| back |  | void | Shows the previous folder of the history. |
| forward |  | void | Shows the next folder of the history. |
| up |  | void | Shows the parent folder, or leaves the search results. |
| openItem | item: FileManagerItem, originalEvent: Event | void | Opens an entry: shows a folder or emits  `onFileOpen`  for a file. |
| search | query: string | void | Searches the folder shown and its sub-folders, when the provider implements  `search` . |
| clearSearch | focus: boolean | void | Leaves the search results and shows the folder again. |
| setView | view: FileManagerView | void | Changes the layout of the content. |
| selectAll |  | void | Selects all the entries shown. |
| clearSelection |  | void | Clears the selection. |
| createFolder | name: string | void | Creates a folder in the folder shown, with a free name, and starts its rename. |
| startRename | item: FileManagerItem | void | Starts the inline rename of an entry. |
| commitRename | focus: boolean | void | Applies the inline rename. |
| rename | item: FileManagerItem, newName: string, focus: boolean | void | Renames an entry through the provider. |
| cancelRename | focus: boolean | void | Ends the inline rename without changing the name. |
| delete | items: FileManagerItem[] | void | Deletes entries, the selected ones by default, after  `onBeforeDelete`  and the confirmation. |
| deleteNow | items: FileManagerItem[] | void | Deletes entries through the provider, with no event nor confirmation. |
| cut | items: FileManagerItem[] | void | Puts entries, the selected ones by default, in the internal clipboard to move them with  `paste()` . |
| copy | items: FileManagerItem[] | void | Puts entries, the selected ones by default, in the internal clipboard to copy them with  `paste()` . |
| paste | targetPath: string | void | Moves or copies the entries of the internal clipboard into a folder, the folder shown by default. |
| move | items: FileManagerItem[], targetPath: string | void | Moves entries into a folder through the provider, after  `onBeforeMove` . |
| copyTo | items: FileManagerItem[], targetPath: string | void | Copies entries into a folder through the provider, after  `onBeforeCopy` . |
| openUploadDialog |  | void | Opens the file dialog of the browser to upload files into the folder shown. |
| upload | files: File[], targetPath: string | void | Uploads files into a folder, the folder shown by default, after  `onBeforeUpload` ; the status bar shows their progress. |
| cancelUpload | id: string | void | Cancels an upload in progress. |
| download | item: FileManagerItem | void | Downloads a file: the provider gives a URL or a Blob, which the browser saves. |

## Pass Through Options

| Name | Type | Description |
|------|------|-------------|
| host | PassThroughOption<HTMLElement, I> | Used to pass attributes to the host's DOM element. |
| root | PassThroughOption<HTMLElement, I> | Used to pass attributes to the root's DOM element. |
| toolbar | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the toolbar. |
| toolbarGroup | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to each group of buttons of the toolbar. |
| pcToolbarButton | ButtonPassThrough | Used to pass attributes to the Button components of the toolbar. |
| search | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the search field. |
| searchInput | PassThroughOption<HTMLInputElement, I> | Used to pass attributes to the search input. |
| sortSelect | PassThroughOption<HTMLSelectElement, I> | Used to pass attributes to the sort select. |
| pcBreadcrumb | BreadcrumbPassThrough | Used to pass attributes to the Breadcrumb component. |
| body | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the body, around the folders and the content. |
| pcSplitter | SplitterPassThrough | Used to pass attributes to the Splitter component. |
| pcTree | TreePassThrough | Used to pass attributes to the Tree component of the folders. |
| pcDrawer | DrawerPassThrough | Used to pass attributes to the Drawer component holding the folders on small screens. |
| content | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the content area. |
| pcTable | TablePassThrough | Used to pass attributes to the Table component of the details view. |
| list | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the listbox of the list and grid views. |
| item | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to each item of the list and grid views. |
| itemIcon | PassThroughOption<HTMLSpanElement, I> | Used to pass attributes to the icon or thumbnail of each item. |
| itemName | PassThroughOption<HTMLSpanElement, I> | Used to pass attributes to the name of each item. |
| renameInput | PassThroughOption<HTMLInputElement, I> | Used to pass attributes to the input of the inline rename. |
| emptyMessage | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the message of an empty folder. |
| preview | PassThroughOption<HTMLElement, I> | Used to pass attributes to the details pane. |
| statusBar | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the status bar. |
| uploads | PassThroughOption<HTMLUListElement, I> | Used to pass attributes to the list of the uploads in progress. |
| pcContextMenu | ContextMenuPassThrough | Used to pass attributes to the ContextMenu component. |
| liveRegion | PassThroughOption<HTMLSpanElement, I> | Used to pass attributes to the live region of the announcements. |

## Theming

### CSS Classes

| Class | Description |
|-------|-------------|
| p-filemanager | Class name of the root element |
| p-filemanager-toolbar | Class name of the toolbar |
| p-filemanager-toolbar-group | Class name of a group of buttons of the toolbar |
| p-filemanager-toolbar-button | Class name of a button of the toolbar |
| p-filemanager-search | Class name of the search field |
| p-filemanager-search-input | Class name of the search input |
| p-filemanager-sort-select | Class name of the sort select |
| p-filemanager-breadcrumb | Class name of the breadcrumb |
| p-filemanager-body | Class name of the body |
| p-filemanager-tree | Class name of the tree of the folders |
| p-filemanager-content | Class name of the content area |
| p-filemanager-table | Class name of the table of the details view |
| p-filemanager-row | Class name of a row of the details view |
| p-filemanager-list | Class name of the listbox of the list and grid views |
| p-filemanager-item | Class name of an item of the list and grid views |
| p-filemanager-item-icon | Class name of the icon of an item |
| p-filemanager-item-name | Class name of the name of an item |
| p-filemanager-rename-input | Class name of the input of the inline rename |
| p-filemanager-empty-message | Class name of the message of an empty folder |
| p-filemanager-preview | Class name of the details pane |
| p-filemanager-status-bar | Class name of the status bar |
| p-filemanager-uploads | Class name of the list of the uploads |

### Design Tokens

| Token | CSS Variable | Description |
|-------|--------------|-------------|
| filemanager.root.background | --p-filemanager-root-background | Background of root |
| filemanager.root.border.color | --p-filemanager-root-border-color | Border color of root |
| filemanager.root.border.radius | --p-filemanager-root-border-radius | Border radius of root |
| filemanager.root.color | --p-filemanager-root-color | Text color of root |
| filemanager.root.height | --p-filemanager-root-height | Height of root |
| filemanager.root.transition.duration | --p-filemanager-root-transition-duration | Transition duration of root |
| filemanager.toolbar.background | --p-filemanager-toolbar-background | Background of toolbar |
| filemanager.toolbar.border.color | --p-filemanager-toolbar-border-color | Border color of toolbar |
| filemanager.toolbar.padding | --p-filemanager-toolbar-padding | Padding of toolbar |
| filemanager.toolbar.gap | --p-filemanager-toolbar-gap | Gap between the groups of toolbar |
| filemanager.search.width | --p-filemanager-search-width | Width of search |
| filemanager.search.background | --p-filemanager-search-background | Background of search |
| filemanager.search.border.color | --p-filemanager-search-border-color | Border color of search |
| filemanager.search.focus.border.color | --p-filemanager-search-focus-border-color | Focus border color of search |
| filemanager.search.color | --p-filemanager-search-color | Text color of search |
| filemanager.search.placeholder.color | --p-filemanager-search-placeholder-color | Placeholder color of search |
| filemanager.search.border.radius | --p-filemanager-search-border-radius | Border radius of search |
| filemanager.search.padding | --p-filemanager-search-padding | Padding of search |
| filemanager.breadcrumb.padding | --p-filemanager-breadcrumb-padding | Padding of breadcrumb |
| filemanager.breadcrumb.border.color | --p-filemanager-breadcrumb-border-color | Border color of breadcrumb |
| filemanager.tree.background | --p-filemanager-tree-background | Background of tree |
| filemanager.tree.padding | --p-filemanager-tree-padding | Padding of tree |
| filemanager.content.background | --p-filemanager-content-background | Background of content |
| filemanager.content.padding | --p-filemanager-content-padding | Padding of content |
| filemanager.item.padding | --p-filemanager-item-padding | Padding of item |
| filemanager.item.gap | --p-filemanager-item-gap | Gap between the icon and the name of item |
| filemanager.item.border.radius | --p-filemanager-item-border-radius | Border radius of item |
| filemanager.item.hover.background | --p-filemanager-item-hover-background | Hover background of item |
| filemanager.item.selected.background | --p-filemanager-item-selected-background | Selected background of item |
| filemanager.item.selected.color | --p-filemanager-item-selected-color | Selected text color of item |
| filemanager.item.cut.opacity | --p-filemanager-item-cut-opacity | Opacity of a cut item |
| filemanager.item.focus.ring.width | --p-filemanager-item-focus-ring-width | Width of the focus ring of item |
| filemanager.item.focus.ring.style | --p-filemanager-item-focus-ring-style | Style of the focus ring of item |
| filemanager.item.focus.ring.color | --p-filemanager-item-focus-ring-color | Color of the focus ring of item |
| filemanager.item.focus.ring.offset | --p-filemanager-item-focus-ring-offset | Offset of the focus ring of item |
| filemanager.item.focus.ring.shadow | --p-filemanager-item-focus-ring-shadow | Shadow of the focus ring of item |
| filemanager.item.icon.color | --p-filemanager-item-icon-color | Color of item icon |
| filemanager.item.icon.folder.color | --p-filemanager-item-icon-folder-color | Color of the icon of a folder |
| filemanager.item.icon.image.color | --p-filemanager-item-icon-image-color | Color of the icon of an image |
| filemanager.grid.item.width | --p-filemanager-grid-item-width | Width of an item in the grid view |
| filemanager.grid.gap | --p-filemanager-grid-gap | Gap between the items in the grid view |
| filemanager.grid.thumbnail.size | --p-filemanager-grid-thumbnail-size | Size of the thumbnails in the grid view |
| filemanager.drop.target.background | --p-filemanager-drop-target-background | Background of drop target |
| filemanager.drop.target.border.color | --p-filemanager-drop-target-border-color | Border color of drop target |
| filemanager.preview.width | --p-filemanager-preview-width | Width of preview |
| filemanager.preview.background | --p-filemanager-preview-background | Background of preview |
| filemanager.preview.border.color | --p-filemanager-preview-border-color | Border color of preview |
| filemanager.preview.padding | --p-filemanager-preview-padding | Padding of preview |
| filemanager.preview.gap | --p-filemanager-preview-gap | Gap of preview |
| filemanager.empty.message.color | --p-filemanager-empty-message-color | Text color of empty message |
| filemanager.empty.message.padding | --p-filemanager-empty-message-padding | Padding of empty message |
| filemanager.empty.message.gap | --p-filemanager-empty-message-gap | Gap of empty message |
| filemanager.status.bar.background | --p-filemanager-status-bar-background | Background of status bar |
| filemanager.status.bar.border.color | --p-filemanager-status-bar-border-color | Border color of status bar |
| filemanager.status.bar.color | --p-filemanager-status-bar-color | Text color of status bar |
| filemanager.status.bar.padding | --p-filemanager-status-bar-padding | Padding of status bar |
| filemanager.status.bar.font.size | --p-filemanager-status-bar-font-size | Font size of status bar |
| filemanager.status.bar.gap | --p-filemanager-status-bar-gap | Gap of status bar |
| filemanager.upload.bar.height | --p-filemanager-upload-bar-height | Height of the progress bar of upload |
| filemanager.upload.bar.background | --p-filemanager-upload-bar-background | Background of the progress bar of upload |
| filemanager.upload.bar.value.background | --p-filemanager-upload-bar-value-background | Background of the value of the progress bar of upload |
| filemanager.error.color | --p-filemanager-error-color | Text color of the errors |

