File Manager
Introduction
Section titled “Introduction”Browses and organizes files held by a host-supplied async provider. A folder tree (Tree View, folders loaded lazily) and the folder content sit side by side in a Splitter, under a toolbar and a breadcrumb path. The content has list and grid views, sorting, multiple selection, rename, new folder, delete with confirmation, move by drag and drop or cut and paste, uploads with progress and cancel, and previews: images open in an Image Viewer lightbox, text and code in a Code Viewer dialog, and anything else through your own preview function. All data goes through the provider (list, createFolder, rename, move, delete, upload, optional getUrl and read), and every call receives an AbortSignal.
- Your storageOne async provider (list, create, rename, move, delete, upload) with an AbortSignal on every call.
- Built from AbsoluteUITree View folders, a Splitter, a Breadcrumb path, menus, dialogs, and progress bars.
- 10,000 files per folderList and grid views on the shared windowing engine keep about 30 entries in the DOM.
- Keyboard firstListbox selection, F2, Delete, Ctrl+X and Ctrl+V moves, Backspace up, and a context menu.
- PreviewsImages open in the Image Viewer, text and code in the Code Viewer, anything else in your preview.
Use it for
- Employee documents, contracts, or attachments that people upload, organize, and preview.
- A document library or shared drive in a business application, backed by your API or storage service.
- Picking or managing files inside a folder hierarchy rather than a flat list.
Use something else for
- Selecting files to send with a form: use File Upload.
- A flat list of uploads with progress: use Upload Queue.
- A hierarchy that is not files and folders: use Tree View.
Anatomy
<div class="aui-file-manager aui-file-manager--list" role="region" aria-label="Employee documents"> <div class="aui-file-manager__toolbar" role="toolbar" aria-label="Employee documents actions"> <button>Up</button> <button>New folder</button> <button>Upload</button> <button>Rename</button> ... <button aria-pressed="true">List view</button> </div> <div class="aui-file-manager__path"><nav class="aui-breadcrumb__nav">Documents > Contracts</nav></div> <div class="aui-file-manager__message"></div> (operation errors) <div class="aui-file-manager__body aui-splitter"> <div class="aui-file-manager__folders"><div role="tree" aria-label="Folders">...</div></div> <div role="separator" aria-label="Folders"></div> <div class="aui-file-manager__content" role="group" aria-label="Contracts"> <div class="aui-file-manager__columns"><button>Name</button><button>Size</button>...</div> <div class="aui-file-manager__viewport" role="listbox" aria-multiselectable="true" aria-label="Contracts" aria-activedescendant="..."> <div class="aui-file-manager__canvas" role="none"> <div class="aui-file-manager__row"> <div class="aui-file-manager__item" role="option" aria-selected="false">icon, name, size, modified, type</div> </div> </div> </div> <div class="aui-file-manager__state"></div> (loading, empty, error) <ul class="aui-file-manager__uploads"><li>progress bar + Cancel</li></ul> </div> </div> <div class="aui-file-manager__status" role="status">12 items, 3 selected</div></div>Live example
Section titled “Live example”Use the bar above each frame to switch theme, density, direction, and locale.
File Manager in the Document center showcase
Section titled “File Manager in the Document center showcase”The part of the Document center showcase that uses File Manager. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.
Showcase source
// Documents showcase: a document center over a simulated provider. The File Manager// browses folders (list or grid, sort, multi-select, rename, new folder, delete, move by drag or// cut and paste, uploads with progress); opening a photo shows it in the Image Viewer (zoom,// rotate, crop to a Blob); opening a text or code file shows it in the Code Viewer with a diff// against its previous version; every change is added to the Timeline of document activity; and// a Tour walks through the page.import { instant, type Instant } from '@absoluteui/core';import { CodeViewer, type CodeLanguage } from '@absoluteui/components/code-viewer';import { FileManager, type FileEntry, type FileManagerCreateFolderDetail, type FileManagerDeleteDetail, type FileManagerErrorDetail, type FileManagerMoveDetail, type FileManagerOpenDetail, type FileManagerProvider, type FileManagerRenameDetail, type FileManagerUploadDetail,} from '@absoluteui/components/file-manager';import { ImageViewer, type ImageViewerImage } from '@absoluteui/components/image-viewer';import { Timeline, type TimelineActionDetail, type TimelineItem, type TimelineTone } from '@absoluteui/components/timeline';import { Tour } from '@absoluteui/components/tour';import { action, choice, createShowcase, hostIn, section, status, toggle, wait } from './kit.js';
const sc = createShowcase({ title: 'Document center', description: 'Browse company documents, preview photos and files, compare versions, follow the activity, and take the guided tour.', simulated: true,});
// Simulated storage: entries, text contents with a previous version, and generated photos.const HOUR = 3_600_000;const now = Date.now();const ago = (hours: number): Instant => instant(now - hours * HOUR);
function photo(color: string, label: string): string { const canvas = document.createElement('canvas'); canvas.width = 640; canvas.height = 400; const ctx = canvas.getContext('2d'); if (ctx) { ctx.fillStyle = color; ctx.fillRect(0, 0, 640, 400); ctx.fillStyle = '#f8fafc'; ctx.beginPath(); ctx.arc(320, 170, 80, 0, Math.PI * 2); ctx.fill(); ctx.fillRect(190, 270, 260, 90); ctx.fillStyle = '#0f172a'; ctx.font = '600 28px sans-serif'; ctx.textAlign = 'center'; ctx.fillText(label, 320, 325); } return canvas.toDataURL('image/png');}
interface Stored { entry: FileEntry; text?: string; previous?: string; url?: string;}
const store = new Map<string, Stored>();let nextId = 1;function put(entry: Omit<FileEntry, 'id'> & { id?: string }, extra: Omit<Stored, 'entry'> = {}): FileEntry { const id = entry.id ?? `f${String(nextId++)}`; const full: FileEntry = { ...entry, id }; store.set(id, { entry: full, ...extra }); return full;}
const policyBefore = '{\n "policy": "Annual leave",\n "annualDays": 25,\n "carryOverDays": 5,\n "approval": "manager"\n}\n';const policyAfter = '{\n "policy": "Annual leave",\n "annualDays": 26,\n "carryOverDays": 5,\n "halfDays": true,\n "approval": ["manager", "hr"]\n}\n';const exportBefore = "export async function exportEmployees(limit = 100): Promise<string> {\n const response = await fetch(`/api/employees?limit=${String(limit)}`);\n return JSON.stringify(await response.json());\n}\n";const exportAfter = "/** Export employees as indented JSON; business days only (see the payroll calendar). */\nexport async function exportEmployees(limit = 100, signal?: AbortSignal): Promise<string> {\n const response = await fetch(`/api/employees?limit=${String(limit)}`, { signal });\n if (!response.ok) throw new Error(`Export failed: ${String(response.status)}`);\n return JSON.stringify(await response.json(), null, 2);\n}\n";const handbook = '# Employee handbook\n\nWelcome to the company. Read the **leave policy** first.\n\n## Working hours\n\n- Core hours: 10:00 to 16:00\n- Public holidays follow the `business calendar`\n';const handbookBefore = '# Employee handbook\n\nWelcome to the company.\n\n## Working hours\n\n- Core hours: 10:00 to 15:00\n';
put({ id: 'policies', name: 'Policies', kind: 'folder', parentId: null, hasChildren: true, modified: ago(30) });put({ id: 'photos', name: 'Badge photos', kind: 'folder', parentId: null, hasChildren: false, modified: ago(50) });put({ id: 'scripts', name: 'Scripts', kind: 'folder', parentId: null, hasChildren: false, modified: ago(70) });put({ id: 'archive', name: 'Archive', kind: 'folder', parentId: null, hasChildren: false, modified: ago(900) });put({ name: 'Employee handbook.md', kind: 'file', parentId: null, size: 18_240, mimeType: 'text/markdown', modified: ago(5) }, { text: handbook, previous: handbookBefore });put({ id: 'leave-policy', name: 'leave-policy.json', kind: 'file', parentId: 'policies', size: 1_204, mimeType: 'application/json', modified: ago(2) }, { text: policyAfter, previous: policyBefore });put({ name: 'travel-policy.md', kind: 'file', parentId: 'policies', size: 9_870, mimeType: 'text/markdown', modified: ago(120) }, { text: '# Travel policy\n\nBook economy for flights under six hours.\n' });put({ id: 'remote', name: 'Remote work', kind: 'folder', parentId: 'policies', hasChildren: false, modified: ago(200) });put({ name: 'export-employees.ts', kind: 'file', parentId: 'scripts', size: 2_310, mimeType: 'text/typescript', modified: ago(26) }, { text: exportAfter, previous: exportBefore });put({ name: 'monthly-report.sql', kind: 'file', parentId: 'scripts', size: 640, mimeType: 'application/sql', modified: ago(300) }, { text: "SELECT department, COUNT(*) AS headcount\nFROM employees\nWHERE status = 'active'\nGROUP BY department\nORDER BY headcount DESC;\n" });const PEOPLE: readonly [string, string][] = [ ['Ada Lovelace', '#1d4ed8'], ['Grace Hopper', '#15803d'], ['Alan Turing', '#b45309'], ['Katherine Johnson', '#7c3aed'],];for (const [index, [person, color]] of PEOPLE.entries()) { put({ name: `${person}.png`, kind: 'file', parentId: 'photos', size: 48_000 + index * 3_100, mimeType: 'image/png', modified: ago(48 + index) }, { url: photo(color, person) });}
const children = (parentId: string | null): FileEntry[] => [...store.values()].map((s) => s.entry).filter((e) => e.parentId === parentId);const latency = (): number => 180 + Math.round(Math.random() * 220);function stored(id: string): Stored { const s = store.get(id); if (!s) throw new Error('The file no longer exists.'); return s;}function withChildren(id: string | null): void { if (id === null) return; const s = store.get(id); if (s) s.entry = { ...s.entry, hasChildren: children(id).some((e) => e.kind === 'folder') };}
const provider: FileManagerProvider = { async list(folderId, { signal }) { await wait(latency(), signal); return children(folderId); }, async createFolder(parentId, name, { signal }) { await wait(latency(), signal); const entry = put({ name, kind: 'folder', parentId, hasChildren: false, modified: instant(Date.now()) }); withChildren(parentId); return entry; }, async rename(entry, name, { signal }) { await wait(latency(), signal); const s = stored(entry.id); s.entry = { ...s.entry, name, modified: instant(Date.now()) }; return s.entry; }, async move(entries, targetFolderId, { signal }) { await wait(latency(), signal); const sources = new Set(entries.map((e) => e.parentId)); const moved = entries.map((e) => { const s = stored(e.id); s.entry = { ...s.entry, parentId: targetFolderId }; return s.entry; }); for (const id of [...sources, targetFolderId]) withChildren(id); return moved; }, async delete(entries, { signal }) { await wait(latency(), signal); const remove = (id: string): void => { for (const child of children(id)) remove(child.id); store.delete(id); }; for (const e of entries) remove(e.id); for (const e of entries) withChildren(e.parentId); }, async upload(folderId, file, { signal, onProgress }) { // Simulated transfer: ten steps; names starting with "fail" are rejected by the "server". for (let step = 1; step <= 10; step++) { await wait(120, signal); onProgress(Math.round((file.size * step) / 10), file.size); } if (file.name.toLowerCase().startsWith('fail')) throw new Error('The server rejected the file.'); const text = /\.(?:ts|js|json|md|txt|sql|css|html|sh)$/i.test(file.name) ? await file.text() : undefined; return put({ name: file.name, kind: 'file', parentId: folderId, size: file.size, mimeType: file.type, modified: instant(Date.now()) }, text === undefined ? {} : { text }); }, async getUrl(entry, { signal }) { await wait(120, signal); const url = stored(entry.id).url; if (url === undefined) throw new Error('This file has no preview.'); return url; }, async read(entry, { signal }) { await wait(120, signal); return stored(entry.id).text ?? ''; },};
// Activity timeline: seeded history plus live entries from the File Manager.const activity: TimelineItem[] = [ { id: 'a1', title: 'Leave policy updated', description: '26 annual days, half days allowed, HR approval added.', tone: 'success', status: 'Published', time: ago(2), avatar: { name: 'Grace Hopper' }, actions: [{ id: 'compare', label: 'Compare versions' }] }, { id: 'a2', title: 'Handbook edited', description: 'Core hours extended to 16:00.', tone: 'info', time: ago(5), avatar: { name: 'Ada Lovelace' }, actions: [{ id: 'compare', label: 'Compare versions' }] }, { id: 'a3', title: 'Export script reviewed', tone: 'neutral', time: ago(26), avatar: { name: 'Alan Turing' } }, { id: 'a4', title: 'Badge photos uploaded', description: 'Four photos for new starters.', tone: 'success', time: ago(48), avatar: { name: 'Katherine Johnson' } }, { id: 'a5', title: 'Virus scan blocked an upload', description: 'invoice.pdf.exe was quarantined.', tone: 'error', status: 'Blocked', time: ago(52) },];let olderPages = 2;let activityId = 100;
// Layout: files, then the two previews, then activity.const filesSection = section(sc, 'Files', ['file-manager', 'tour']);const fm = FileManager.create(hostIn(filesSection), { label: 'Company documents', root: { id: null, label: 'Documents' }, provider, height: '30rem', maxFileSize: 5_000_000,});const fmStatus = status(filesSection);fmStatus.textContent = 'Open a photo or a file (Enter or double click) to preview it.';sc.listen(fm.host, ['aui-navigate', 'aui-change', 'aui-open', 'aui-create-folder', 'aui-rename', 'aui-move', 'aui-delete', 'aui-upload', 'aui-error'], 'file-manager');
// The tour walks every section, so every section lists it.const previewSection = section(sc, 'Photos', ['image-viewer', 'tour']);const images = (): ImageViewerImage[] => children('photos') .filter((e) => e.mimeType?.startsWith('image/') === true) .map((e) => ({ src: stored(e.id).url ?? '', alt: `Badge photo of ${e.name.replace(/\.png$/, '')}`, caption: e.name, downloadName: e.name })) .filter((i) => i.src !== '');const viewer = ImageViewer.create(hostIn(previewSection), { label: 'Badge photos', images: images(), croppable: true, aspectRatios: [{ label: 'Badge (1:1)', value: 1 }, { label: '4:3', value: 4 / 3 }, { label: 'Free', value: null }] });sc.listen(viewer.host, ['aui-change', 'aui-zoom', 'aui-rotate', 'aui-crop', 'aui-error'], 'image-viewer');
const LANGUAGES: Readonly<Record<string, CodeLanguage>> = { json: 'json', ts: 'typescript', js: 'javascript', md: 'markdown', sql: 'sql', css: 'css', html: 'html', sh: 'bash' };const languageOf = (name: string): CodeLanguage => LANGUAGES[name.split('.').pop()?.toLowerCase() ?? ''] ?? 'plain';let diffMode: 'unified' | 'split' = 'unified';let showDiff = true;let current = stored('leave-policy');const codeSection = section(sc, 'File preview', ['code-viewer', 'tour']);const code = CodeViewer.create(hostIn(codeSection), { label: 'File preview', filename: current.entry.name, language: 'json', diff: { original: policyBefore, modified: policyAfter, mode: diffMode, originalLabel: 'Previous version', modifiedLabel: 'Current version' } });sc.listen(code.host, ['aui-copy', 'aui-change'], 'code-viewer');
function showCode(s: Stored): void { current = s; const text = s.text ?? ''; const language = languageOf(s.entry.name); if (showDiff && s.previous !== undefined) code.update({ filename: s.entry.name, language, code: '', diff: { original: s.previous, modified: text, mode: diffMode, originalLabel: 'Previous version', modifiedLabel: 'Current version' } }); else code.update({ filename: s.entry.name, language, diff: null, code: text });}
fm.host.addEventListener('aui-open', (event) => { const { entry } = (event as CustomEvent<FileManagerOpenDetail>).detail; const s = store.get(entry.id); if (!s) return; // The page shows previews inline instead of the File Manager's dialog, unless the preview // section is hidden (the File Manager's focus view on a component page). const inline = s.url !== undefined ? !previewSection.hidden : s.text !== undefined && !codeSection.hidden; if (!inline) return; event.preventDefault(); if (s.url !== undefined) { const list = images(); viewer.update({ images: list, index: Math.max(0, list.findIndex((i) => i.caption === entry.name)) }); fmStatus.textContent = `Showing ${entry.name} in the image viewer.`; viewer.host.scrollIntoView({ block: 'nearest' }); } else if (s.text !== undefined) { showCode(s); fmStatus.textContent = s.previous === undefined ? `Showing ${entry.name}.` : `Showing the changes to ${entry.name}.`; code.host.scrollIntoView({ block: 'nearest' }); }});
const activitySection = section(sc, 'Activity', ['timeline', 'tour']);const timeline = Timeline.create(hostIn(activitySection), { label: 'Document activity', items: activity, initialVisible: 4, hasMore: true, loadMore: async ({ signal }) => { await wait(500, signal); olderPages--; const base = 24 * (6 + (2 - olderPages) * 3); return [ { id: `old-${String(olderPages)}-1`, title: 'Contract template replaced', tone: 'info', time: ago(base), avatar: { name: 'Ada Lovelace' } }, { id: `old-${String(olderPages)}-2`, title: 'Archive folder cleaned up', tone: 'warning', description: '12 files older than seven years removed.', time: ago(base + 30) }, ]; },});sc.listen(timeline.host, ['aui-action', 'aui-toggle', 'aui-load-more', 'aui-load-error'], 'timeline');timeline.host.addEventListener('aui-load-more', () => { if (olderPages <= 0) timeline.update({ hasMore: false });});timeline.host.addEventListener('aui-action', (event) => { const { item } = (event as CustomEvent<TimelineActionDetail>).detail; const target = item.id === 'a2' ? [...store.values()].find((s) => s.entry.name === 'Employee handbook.md') : stored('leave-policy'); if (target) { showDiff = true; showCode(target); code.host.scrollIntoView({ block: 'nearest' }); }});
function record(title: string, tone: TimelineTone, description?: string): void { activity.unshift({ id: `live-${String(activityId++)}`, title, tone, time: instant(Date.now()), avatar: { name: 'You' }, ...(description === undefined ? {} : { description }) }); timeline.update({ items: [...activity] });}const names = (list: readonly FileEntry[]): string => list.map((e) => e.name).join(', ');fm.host.addEventListener('aui-create-folder', (e) => { record('Folder created', 'success', (e as CustomEvent<FileManagerCreateFolderDetail>).detail.entry.name);});fm.host.addEventListener('aui-rename', (e) => { const d = (e as CustomEvent<FileManagerRenameDetail>).detail; record('Renamed', 'info', `${d.previousName} to ${d.entry.name}`);});fm.host.addEventListener('aui-move', (e) => { record('Moved', 'info', names((e as CustomEvent<FileManagerMoveDetail>).detail.entries));});fm.host.addEventListener('aui-delete', (e) => { record('Deleted', 'warning', names((e as CustomEvent<FileManagerDeleteDetail>).detail.entries));});fm.host.addEventListener('aui-upload', (e) => { record('Uploaded', 'success', (e as CustomEvent<FileManagerUploadDetail>).detail.entry.name);});fm.host.addEventListener('aui-error', (e) => { const d = (e as CustomEvent<FileManagerErrorDetail>).detail; record(`Failed: ${d.operation}`, 'error', d.error instanceof Error ? d.error.message : undefined);});
// Guided tour of the page.const tour = Tour.create(hostIn(filesSection), { dots: true, steps: [ { id: 'welcome', title: 'Welcome to the document center', content: 'A short tour: files, previews, and activity. Press Escape to leave at any time.' }, { id: 'toolbar', title: 'File actions', content: 'Create folders, upload, rename, delete, cut and paste, sort, and switch between list and grid.', target: () => fm.host.querySelector('[role="toolbar"]'), placement: 'bottom-start' }, { id: 'folders', title: 'Folders', content: 'Browse the folder tree; drop files on a folder to move them.', target: () => fm.host.querySelector('.aui-file-manager__folders'), placement: 'right' }, { id: 'photos', title: 'Photo viewer', content: 'Zoom, rotate, and crop badge photos to a square.', target: () => viewer.host, placement: 'top' }, { id: 'code', title: 'Compare versions', content: 'See what changed in a file, unified or side by side.', target: () => code.host, placement: 'top' }, { id: 'activity', title: 'Activity', content: 'Every change you make is added here, grouped by day.', target: () => timeline.host, placement: 'top' }, ],});sc.listen(tour.host, ['aui-start', 'aui-step-change', 'aui-step-missing', 'aui-finish', 'aui-skip'], 'tour');
// Options.action(sc, 'Start tour', () => { void tour.start();}, ['tour']);choice(sc, 'View', [{ value: 'list', label: 'List' }, { value: 'grid', label: 'Grid' }], 'list', (view) => { fm.update({ view });}, ['file-manager']);toggle(sc, 'Folder pane', true, (checked) => { fm.update({ showFolderPane: checked });}, ['file-manager']);toggle(sc, 'Read-only', false, (checked) => { fm.update({ readOnly: checked });}, ['file-manager']);toggle(sc, 'Show changes', true, (checked) => { showDiff = checked; showCode(current);}, ['code-viewer']);choice(sc, 'Diff layout', [{ value: 'unified', label: 'Unified' }, { value: 'split', label: 'Side by side' }], 'unified', (mode) => { diffMode = mode; showCode(current);}, ['code-viewer']);choice(sc, 'Timeline layout', [{ value: 'start', label: 'Start' }, { value: 'alternate', label: 'Alternate' }], 'start', (layout) => { timeline.update({ layout });}, ['timeline']);choice(sc, 'Times', [{ value: 'relative', label: 'Relative' }, { value: 'absolute', label: 'Absolute' }], 'relative', (timeFormat) => { timeline.update({ timeFormat });}, ['timeline']);timeline.update({ timeFormat: 'relative' });In-memory provider
Section titled “In-memory provider”import { instant } from '@absoluteui/core';import { FileManager, type FileEntry, type FileManagerProvider } from '@absoluteui/components/file-manager';
// An in-memory provider; a real one calls your API and passes request.signal to fetch.const entries: FileEntry[] = [ { id: 'contracts', name: 'Contracts', kind: 'folder', parentId: null }, { id: 'policies', name: 'Policies', kind: 'folder', parentId: null, hasChildren: false }, { id: 'offer', name: 'Offer letter.txt', kind: 'file', size: 2048, mimeType: 'text/plain', modified: instant(Date.UTC(2026, 2, 3, 9, 30)), parentId: 'contracts' },];let next = 1;const provider: FileManagerProvider = { list: async (folderId) => entries.filter((e) => e.parentId === folderId), createFolder: async (parentId, name) => { const entry: FileEntry = { id: `folder-${String(next++)}`, name, kind: 'folder', parentId }; entries.push(entry); return entry; }, rename: async (entry, name) => ({ ...entry, name }), move: async (moved, targetFolderId) => moved.map((e) => ({ ...e, parentId: targetFolderId })), delete: async () => {}, upload: async (folderId, file, request) => { request.onProgress(file.size, file.size); return { id: `file-${String(next++)}`, name: file.name, kind: 'file', size: file.size, mimeType: file.type, parentId: folderId }; }, read: async () => 'Dear Ada, we are pleased to offer you the position.',};
const host = document.createElement('div');document.body.append(host);const files = FileManager.create(host, { label: 'Employee documents', provider, root: { id: null, label: 'Documents' }, maxFileSize: 10_000_000 });host.addEventListener('aui-navigate', () => { host.dataset.folder = files.currentFolderId ?? 'root';});Read-only grid with your own PDF handling
Section titled “Read-only grid with your own PDF handling”import { FileManager, type FileManagerErrorDetail, type FileManagerOpenDetail, type FileManagerProvider } from '@absoluteui/components/file-manager';
declare const provider: FileManagerProvider;
const host = document.createElement('div');document.body.append(host);FileManager.create(host, { label: 'Scans', provider, view: 'grid', readOnly: true, accept: ['image/*', '.pdf'] });host.addEventListener('aui-open', (event) => { const { entry } = (event as CustomEvent<FileManagerOpenDetail>).detail; // Handle PDFs yourself; images still open in the built-in Image Viewer. if (entry.mimeType === 'application/pdf') { event.preventDefault(); window.open(`/documents/${encodeURIComponent(entry.id)}`, '_blank', 'noopener'); }});host.addEventListener('aui-error', (event) => { const { operation } = (event as CustomEvent<FileManagerErrorDetail>).detail; host.dataset.lastError = operation;});Custom preview without the folder pane
Section titled “Custom preview without the folder pane”import { FileManager, type FileManagerProvider } from '@absoluteui/components/file-manager';
declare const provider: FileManagerProvider;
const host = document.createElement('div');document.body.append(host);FileManager.create(host, { label: 'Reports', provider, showFolderPane: false, height: '24rem', preview: async (entry, { signal }) => { if (!entry.name.endsWith('.csv') || !provider.read) return null; const text = await provider.read(entry, { signal }); const pre = document.createElement('pre'); pre.textContent = text.split('\n').slice(0, 20).join('\n'); return pre; },});Install and start
Section titled “Install and start”npm install @absoluteui/components @absoluteui/core @absoluteui/themeRegistry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.
import { FileManager } from '@absoluteui/components/file-manager';import '@absoluteui/components/button/style.css';import '@absoluteui/components/breadcrumb/style.css';import '@absoluteui/components/tree-view/style.css';import '@absoluteui/components/splitter/style.css';import '@absoluteui/components/menu/style.css';import '@absoluteui/components/context-menu/style.css';import '@absoluteui/components/dialog/style.css';import '@absoluteui/components/text-input/style.css';import '@absoluteui/components/empty-state/style.css';import '@absoluteui/components/spinner/style.css';import '@absoluteui/components/inline-message/style.css';import '@absoluteui/components/progress-bar/style.css';import '@absoluteui/components/image-viewer/style.css';import '@absoluteui/components/code-viewer/style.css';import '@absoluteui/components/file-manager/style.css';First use
Section titled “First use”import { FileManager, type FileManagerProvider } from '@absoluteui/components/file-manager';import '@absoluteui/components/button/style.css';import '@absoluteui/components/breadcrumb/style.css';import '@absoluteui/components/tree-view/style.css';import '@absoluteui/components/splitter/style.css';import '@absoluteui/components/menu/style.css';import '@absoluteui/components/context-menu/style.css';import '@absoluteui/components/dialog/style.css';import '@absoluteui/components/text-input/style.css';import '@absoluteui/components/empty-state/style.css';import '@absoluteui/components/spinner/style.css';import '@absoluteui/components/inline-message/style.css';import '@absoluteui/components/progress-bar/style.css';import '@absoluteui/components/image-viewer/style.css';import '@absoluteui/components/code-viewer/style.css';import '@absoluteui/components/file-manager/style.css';
declare const provider: FileManagerProvider;const host = document.querySelector<HTMLElement>('#files');if (host) FileManager.create(host, { label: 'Shared drive', provider });More usage
import { FileManager, type FileManagerProvider } from '@absoluteui/components/file-manager';
declare const provider: FileManagerProvider;const host = document.querySelector<HTMLElement>('#documents');if (host) { const files = FileManager.create(host, { label: 'Employee documents', provider, root: { id: 'emp-42', label: 'Ada Lovelace' }, accept: ['image/*', '.pdf', '.txt'] }); host.addEventListener('aui-upload', () => { void files.refresh(); });}Using Angular? See File Manager for Angular.
API reference
Section titled “API reference”Factory
Section titled “Factory”FileManager.create(host: HTMLElement, options: FileManagerOptions): FileManagerGlobal configuration key: fileManager (see Configuration).
Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
label |
string |
Accessible name of the File Manager region, such as ‘Company documents’. Required. | |
provider |
FileManagerProvider |
Async storage: list, createFolder, rename, move, delete, upload, and optional getUrl and read; every call receives an AbortSignal. Required. | |
root |
FileManagerRoot |
"{ id: null, label }" |
The top folder { id, label }; changing it lists the new root. |
readOnly |
boolean |
"false" |
No create, rename, move, delete, or upload. |
accept |
readonly string[] |
Accepted uploads: MIME types (image/*) and extensions (.csv). | |
maxFileSize |
number |
Largest accepted upload in bytes. | |
preview |
'auto' | false | FileManagerPreview |
"auto" |
Preview of opened files: auto (images in an Image Viewer lightbox, text and code in a Code Viewer dialog), false, or a function returning a Node. |
height |
string | null |
"32rem" |
Block size as a CSS length, or null to fill the host. |
icons |
Partial<FileManagerIcons> |
Entry and toolbar icons. | |
view |
'list' | 'grid' |
"list" |
List rows with columns, or tiles. Globally configurable. |
sortBy |
'name' | 'size' | 'modified' | 'type' |
"name" |
Sort key. Globally configurable. |
sortDirection |
'asc' | 'desc' |
"asc" |
Sort direction. Globally configurable. |
foldersFirst |
boolean |
"true" |
Folders before files, whatever the sort. Globally configurable. |
showFolderPane |
boolean |
"true" |
Show the folder tree next to the content. Globally configurable. |
locale |
string |
"en-US" |
Locale of sizes, dates, sorting, and messages. Globally configurable. Inherited from common configuration. |
timezone |
string |
"UTC" |
IANA timezone of modified dates. Globally configurable. Inherited from common configuration. |
density |
'compact' | 'comfortable' | 'spacious' |
"comfortable" |
Row and tile size. Globally configurable. Inherited from common configuration. |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
host |
HTMLElement |
The host element. |
options |
Readonly<FileManagerOptions> |
Current options. |
currentFolderId |
string | null |
The folder shown. |
path |
FileManagerPathItem[] |
The path from the root to the current folder. |
selected |
string[] |
Ids of the selected entries. |
entries |
readonly FileEntry[] |
Entries of the current folder in display order. |
view |
FileManagerView |
The current view. |
loading |
boolean |
A folder listing is in progress. |
Methods
Section titled “Methods”| Method | Description |
|---|---|
navigate(folderId: string | null): Promise<void> |
Show a folder (aborts a pending listing). |
refresh(): Promise<void> |
List the current folder again. |
select(ids: readonly string[]): void |
Select entries of the current folder (no event). |
upload(files: readonly File[]): void |
Upload files to the current folder (checked against accept and maxFileSize). |
update(options: Partial<FileManagerOptions>): void |
Merge and apply options; a new provider or root clears the cache and lists the root. |
destroy(): void |
Abort every provider call and remove rendering, dialogs, and listeners. |
Events
Section titled “Events”| Event | Detail | Bubbles | Cancelable | Description |
|---|---|---|---|---|
aui-navigate |
FileManagerNavigateDetail |
Yes | No | Another folder is shown: { folderId, path }. |
aui-change |
FileManagerChangeDetail |
Yes | No | The user changed the selection: { selected }. |
aui-open |
FileManagerOpenDetail |
Yes | Yes | A file was opened (Enter or double click): { entry }; preventDefault() suppresses the built-in preview. |
aui-create-folder |
FileManagerCreateFolderDetail |
Yes | No | A folder was created: { entry }. |
aui-rename |
FileManagerRenameDetail |
Yes | No | An entry was renamed: { entry, previousName }. |
aui-move |
FileManagerMoveDetail |
Yes | No | Entries were moved: { entries, targetFolderId, source: ‘drag’ | ‘paste’ }. |
aui-delete |
FileManagerDeleteDetail |
Yes | No | Entries were deleted: { entries }. |
aui-upload |
FileManagerUploadDetail |
Yes | No | One file finished uploading: { entry, file }. |
aui-error |
FileManagerErrorDetail |
Yes | No | A provider call failed: { operation, error, entries }. |
Content areas
Section titled “Content areas”| Area | Description |
|---|---|
preview |
A custom preview function returns a Node shown in a dialog titled with the file name. |
CSS classes
Section titled “CSS classes”All rules live in the aui.components cascade layer, so application styles override them without specificity battles.
| Class | Purpose |
|---|---|
aui-file-manager |
Host (role=region). |
aui-file-manager--list | --grid |
View. |
aui-file-manager--fill | --no-pane | --readonly |
Fills the host; no folder pane; read-only. |
aui-file-manager__toolbar |
Toolbar (role=toolbar). |
aui-file-manager__path |
Breadcrumb path. |
aui-file-manager__message |
Operation error message. |
aui-file-manager__body |
Splitter of the folder pane and the content. |
aui-file-manager__folders |
Folder tree pane. |
aui-file-manager__content |
Content pane. |
aui-file-manager__columns |
Sort buttons above the list view. |
aui-file-manager__viewport |
The listbox (scroll container). |
aui-file-manager__item |
One entry (role=option); –folder, –file, –selected, –active, –cut. |
aui-file-manager__drop-target |
Folder under a drag. |
aui-file-manager__state |
Loading, empty, and error states. |
aui-file-manager__uploads |
Upload progress list. |
aui-file-manager__status |
Status bar (role=status). |
Icon slots
Section titled “Icon slots”| Slot | Default icon |
|---|---|
folder |
folder |
folderOpen |
folder-open |
file |
file |
image |
file-image |
code |
file-code |
text |
file-text |
up |
arrow-up |
newFolder |
folder-plus |
upload |
upload |
rename |
edit |
delete |
trash |
cut |
cut |
paste |
clipboard |
sort |
arrow-up-down |
list |
layout-list |
grid |
layout-grid |
refresh |
refresh |
Design tokens
Section titled “Design tokens”Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.
--aui-border-width | --aui-color-border | --aui-color-focus-ring | --aui-color-hover | --aui-color-info-subtle | --aui-color-selected | --aui-color-selected-indicator | --aui-color-selected-text | --aui-color-surface | --aui-color-text | --aui-color-text-muted | --aui-focus-ring-offset | --aui-focus-ring-width | --aui-font-family-sans | --aui-font-size-md | --aui-font-size-sm | --aui-font-weight-semibold | --aui-icon-size-md | --aui-icon-size-xl | --aui-line-height-normal | --aui-radius-md | --aui-radius-pill | --aui-space-1 | --aui-space-2 | --aui-space-3
TypeScript definitions
interface FileEntry { readonly id: string; readonly name: string; readonly kind: 'folder' | 'file'; readonly size?: number; readonly modified?: Instant; readonly mimeType?: string; readonly parentId: string | null; readonly hasChildren?: boolean; readonly readOnly?: boolean }interface FileManagerRequest { readonly signal: AbortSignal }interface FileManagerUploadRequest extends FileManagerRequest { readonly onProgress: (loaded: number, total: number) => void }interface FileManagerProvider { list(folderId: string | null, request: FileManagerRequest): Promise<readonly FileEntry[]>; createFolder(parentId: string | null, name: string, request: FileManagerRequest): Promise<FileEntry>; rename(entry: FileEntry, name: string, request: FileManagerRequest): Promise<FileEntry>; move(entries: readonly FileEntry[], targetFolderId: string | null, request: FileManagerRequest): Promise<readonly FileEntry[]>; delete(entries: readonly FileEntry[], request: FileManagerRequest): Promise<void>; upload(folderId: string | null, file: File, request: FileManagerUploadRequest): Promise<FileEntry>; getUrl?(entry: FileEntry, request: FileManagerRequest): Promise<string>; read?(entry: FileEntry, request: FileManagerRequest): Promise<string>;}type FileManagerPreview = (entry: FileEntry, context: { readonly signal: AbortSignal; readonly provider: FileManagerProvider }) => Node | null | Promise<Node | null>;interface FileManagerConfig { view: 'list' | 'grid'; sortBy: 'name' | 'size' | 'modified' | 'type'; sortDirection: 'asc' | 'desc'; foldersFirst: boolean; showFolderPane: boolean }interface FileManagerOptions extends Partial<FileManagerConfig> { label: string; provider: FileManagerProvider; root?: { id: string | null; label: string }; readOnly?: boolean; accept?: readonly string[]; maxFileSize?: number; preview?: 'auto' | false | FileManagerPreview; height?: string | null; locale?: string; timezone?: string; density?: Density; icons?: Partial<FileManagerIcons>;}interface FileManagerNavigateDetail { folderId: string | null; path: { id: string | null; label: string }[] }interface FileManagerChangeDetail { selected: string[] }interface FileManagerOpenDetail { entry: FileEntry }interface FileManagerRenameDetail { entry: FileEntry; previousName: string }interface FileManagerMoveDetail { entries: FileEntry[]; targetFolderId: string | null; source: 'drag' | 'paste' }interface FileManagerErrorDetail { operation: FileManagerOperation; error: unknown; entries: FileEntry[] }Accessibility and performance
Section titled “Accessibility and performance”Accessibility
Section titled “Accessibility”Pattern: A labelled region with a WAI-ARIA APG toolbar, a Breadcrumb navigation, a Tree View of folders, and the folder content as an APG listbox with multiple selection (focus stays on the listbox; aria-activedescendant names the active entry). Dialogs follow the APG dialog and alertdialog patterns.
Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.
Keyboard
Section titled “Keyboard”| Key | Context | Action |
|---|---|---|
| ArrowUp / ArrowDown | Content | Previous or next entry (the row above or below in the grid view); selects it. |
| ArrowLeft / ArrowRight | Content, grid view | Previous or next tile in reading order. |
| Home / End / PageUp / PageDown | Content | First, last, or one page of entries. |
| Shift+Arrow, Shift+Space, Shift+click | Content | Extend the selection from the anchor. |
| Ctrl+Arrow, then Ctrl+Space; Ctrl+click | Content | Move without selecting, then toggle the entry. |
| Ctrl+A | Content | Select all entries. |
| Enter / double click | Content | Open: folders are shown, files previewed. |
| Backspace / Alt+ArrowUp | Content | Go to the parent folder. |
| F2 | Content | Rename the selected entry. |
| Delete | Content | Delete the selection (after confirmation). |
| Ctrl+X / Ctrl+V | Content | Cut the selection; paste it into the current folder. |
| Ctrl+Shift+N | Content | New folder. |
| Shift+F10 / ContextMenu | Content | Actions for the selection. |
| Escape | Content | Cancel a cut, then clear the selection. |
| Type characters | Content | Move to the next entry whose name starts with them. |
| ArrowLeft / ArrowRight / Home / End | Toolbar | Move between enabled toolbar buttons. |
| Element | Role |
|---|---|
| host | region (labelled by label) |
| toolbar | toolbar |
| path | navigation (Breadcrumb) |
| folder pane | tree (Tree View) |
| content | listbox with option children (list rows or grid tiles) |
| status bar | status |
| delete confirmation | alertdialog |
| name prompt and preview | dialog |
ARIA attributes
Section titled “ARIA attributes”| Attribute | Element | Value |
|---|---|---|
aria-multiselectable |
listbox | true |
aria-activedescendant |
listbox | id of the active option |
aria-selected |
option | true | false |
aria-posinset / aria-setsize |
option | position in the folder (options are virtualized) |
aria-busy |
listbox | true while the folder loads |
aria-pressed |
view buttons | true for the current view |
aria-label |
listbox | name of the current folder |
The listbox keeps focus while the active entry moves (aria-activedescendant), so virtualized scrolling never loses focus. After opening a folder focus stays in the content (an empty folder focuses its first action); after going up the folder you came from is active. Dialogs move focus inside and restore it on close; after a dialog the list is focused again.
WCAG 2.2 success criteria addressed
Section titled “WCAG 2.2 success criteria addressed”Automated test results: Accessibility and compliance.
Notes and known caveats
Section titled “Notes and known caveats”- Every drag-and-drop move has a keyboard alternative (Ctrl+X, Ctrl+V, or the context menu), satisfying 2.5.7 Dragging Movements.
- The status bar announces the item and selection counts; operations announce their result (created, renamed, moved, deleted, uploaded) and errors are shown as text and announced assertively.
- Selection is shown by a bar or a ring as well as the fill, not by color alone.
- Manual screen-reader verification (NVDA, JAWS, VoiceOver) is pending.
- Options in the grid view are grouped in presentational rows; screen readers announce them as one list.
Performance
Section titled “Performance”| Import cost | Minified | gzip | brotli | CSS brotli |
|---|---|---|---|---|
@absoluteui/components/file-manager |
250.8 kB | 73.8 kB | 62.8 kB | 1.4 kB |
Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.
| Budget (enforced in CI) | Limit |
|---|---|
| Render a folder of 10,000 entries in the list view (after the provider resolves) | < 50 ms in headless Chromium; about 30 option elements in the DOM |
| Scroll frame in a 10,000-entry folder | < 4 ms of script per frame |
| Selection change (click or arrow key) | < 2 ms: attributes of the rendered options only |
Tested scale: 10,000 entries per folder in the list and grid views (virtualized); folder trees a few thousand folders deep in total, loaded lazily.
The content is virtualized on the shared windowing engine: about 30 options are in the DOM whatever the folder size. A selection change updates the attributes of the rendered options only. Folders of the tree load when expanded.
Measured run times: Performance.
Details
Section titled “Details”States
Loading, ready, empty folder, load error; list and grid views; with a selection; cut entries (dimmed); drag over a folder or the pane; uploading, upload error; operation error message; read-only; without the folder pane.
State transitions
| From | Trigger | To |
|---|---|---|
| any | open a folder, path link, tree folder, navigate() |
loading, then ready, empty, or error (aui-navigate) |
| error | Try again, refresh() |
loading |
| ready | click, arrows, Space, Ctrl+A | new selection (aui-change) |
| ready | New folder, F2, Delete, paste, drop, upload | provider call, then the view updates (or an error message and aui-error) |
| ready | Enter or double click on a file | aui-open, then the preview unless canceled |
Accessibility notes
- Every drag-and-drop move has a keyboard and context menu alternative (2.5.7 Dragging Movements).
- Results are announced (folder opened with its item count, created, renamed, moved, deleted, uploaded); errors appear as text and are announced assertively.
- Focus stays on the listbox while the active entry moves, so virtualization never loses focus; dialogs restore focus to the list.
- Selection is shown by a bar (list) or ring (grid) besides the fill.
- The e2e axe run covers three themes; manual screen-reader verification is pending.
Responsive behavior
The toolbar wraps; the folder pane is a collapsible Splitter pane (or hidden with showFolderPane: false); the grid fits as many tiles per row as the width allows and recomputes on resize; list columns shrink and truncate.
Right-to-left
Toolbar, path, panes, columns, and tiles follow the writing direction. In the grid ArrowLeft and ArrowRight follow the reading order; toolbar arrows are mirrored.
Theming
Names, columns, selection, drop target, and focus pairs are in the contrast gate in every theme. Forced colors draw the selection in Highlight and HighlightText and drop targets with a Highlight outline.
Global configuration
configureAbsoluteUI({ components: { fileManager: { view: 'grid', sortBy: 'modified', sortDirection: 'desc' } } });Component configuration
Instance options override configuration; the toolbar’s view, sort, and folders-first choices update the instance options.
Timezones
Modified dates (Instants from the provider) are formatted in the configured timezone with the configured locale.
Icons
icons: folder, folderOpen, file, image, code, text (entries and tree), and up, newFolder, upload, rename, delete, cut, paste, sort, list, grid, refresh (toolbar and menus). Defaults come from @absoluteui/icons/set.
Security
Names and every provider string are set as text. New names are validated: not empty, no / or \, not . or .., no control characters, at most 255 characters, unique in the folder. Provider entries are validated (an invalid listing is a load error with code FILE_MANAGER_PROVIDER). Image previews use the Image Viewer URL policy (https:, blob:, raster data:, same origin). accept and maxFileSize are checked in the browser only; the server must check uploads again.
Data handling
No persistence, network access, or telemetry of its own: all data goes through the provider. Listings are cached per folder in memory until refresh() or a new provider or root.
Supported data scale
10,000 entries per folder in both views; folder trees of a few thousand folders, loaded lazily.
Edge cases
- Navigating while a folder loads aborts the earlier listing; a late answer is ignored.
- Moving a folder into itself or one of its sub-folders is refused before the provider is called.
- Names that differ only in case count as duplicates.
- Pasting cut entries into the folder they are already in is unavailable.
- An empty folder replaces the listbox with an empty state (an empty listbox is not allowed); focus moves to its first action.
Errors
| Code | Category | Cause |
|---|---|---|
FILE_MANAGER_OPTIONS |
configuration | Blank label, a provider without the required functions, an invalid root, accept, maxFileSize, preview, or height. |
FILE_MANAGER_PROVIDER |
runtime | The provider returned invalid entries (reported through aui-error, never thrown). |
CFG_INVALID_VALUE / CFG_UNKNOWN_OPTION |
configuration | Invalid or unknown configuration. |
Invalid options throw before the host is modified; an invalid update() leaves the previous state intact. Provider failures never throw: they show an error state or message and emit aui-error.
Known limitations
- No copy operation (the provider contract has no copy).
- Folders dropped from the operating system are not expanded; only files upload.
navigate()knows the full path only of folders listed before.- Manual screen-reader verification is pending.
Unsupported scenarios
- Inline name editing in the list (rename uses a dialog).
- Built-in preview of PDF, office, audio, or video files: pass a
previewfunction.
(c) 2026 Kasadara Technology Solutions Pvt Ltd. AbsoluteUI is free to use under the AbsoluteUI Free Use License; it is not open source.