Apps

File manager

Nested folders, grid and list views, uploads with progress, drag to move, storage by kind and a file panel.

composables/apps/useFileManager.ts
View in the demo

Folders nest through parentId. Files carry owner, sharedWith, createdAt, updatedBy and an optional previewUrl (uploaded images get an object URL, so they preview without a server).

Every app follows the same pattern: typed models in types/models/, demo data in mocks/, state and actions in a composable under composables/apps/, page-only components in components/pages/<app>/ and UI strings in locales/<code>/apps.json. Read the apps overview once and every app looks familiar.

Files

File
Role
pages/file-manager.vueThe page: sidebar, browser and file panel.
composables/apps/useFileManager.tsFiles, folders, filters, sorting, uploads and trash.
types/models/files.tsFiles, folders and the provider.
config/files.config.tsSections, file kinds, folder colours and the default view.
utils/files.tsPure rules, unit tested.
components/pages/file-manager/FileManagerSidebar, FileManagerBrowser, FileManagerFileCard, FileManagerFolderCard, FileManagerFilePanel, FileManagerUploads, FileManagerToolbar, FileManagerSelectionBar.

Data and provider

types/models/files.ts
export interface FilesProvider {
  load: () => Promise<FileManagerState>
  saveFile: (file: FileEntry) => Promise<void>
  removeFile: (id: string) => Promise<void>
  saveFolder: (folder: FileFolder) => Promise<void>
  removeFolder: (id: string) => Promise<void>
}

Connect your backend

The page calls useFileManager() with the mock provider. Write a provider that calls your API with useApi() and pass it in the page. The composable loads it through useAsyncData and applies every change optimistically, so the interface does not wait for the server.

providers/files.ts
import type { FileManagerState, FilesProvider } from '~/types/models/files'

export function createFilesApiProvider(): FilesProvider {
  const api = useApi()

  return {
    load: () => api<FileManagerState>('/files'),
    saveFile: (file) => api(`/files/${file.id}`, { method: 'PUT', body: file }),
    removeFile: (id) => api(`/files/${id}`, { method: 'DELETE' }),
    saveFolder: (folder) => api(`/folders/${folder.id}`, { method: 'PUT', body: folder }),
    removeFolder: (id) => api(`/folders/${id}`, { method: 'DELETE' }),
  }
}
pages/file-manager.vue
<script setup lang="ts">
import { createFilesApiProvider } from '~/providers/files'

const { ... } = useFileManager({ provider: createFilesApiProvider() })
</script>

Keep ids in your data and labels in the locales: folders, labels and tags resolve their names through apps.<app>.* unless you give them a raw title. See Connect your API for the token, validation errors and the actions the demo only fakes.

Configuration

FILE_SECTIONS

The sections of the sidebar.

config/files.config.ts
const FILE_SECTIONS: FileSectionConfig[]

FILE_KINDS

File kinds with their extensions, icon and colour.

config/files.config.ts
const FILE_KINDS: FileKindConfig[]

FILE_FOLDER_COLORS

The colours a folder can take.

config/files.config.ts
const FILE_FOLDER_COLORS: string[]

FILE_DEFAULT_VIEW

grid or list. The user’s choice persists in the files-view cookie.

config/files.config.ts
const FILE_DEFAULT_VIEW: FileViewSettings

FILE_RECENT_DAYS

How many days a file counts as recent.

config/files.config.ts
const FILE_RECENT_DAYS: 7

FILE_UPLOAD_STEP_MS

The step of the simulated upload progress. Remove it when you upload for real.

config/files.config.ts
const FILE_UPLOAD_STEP_MS: 120

Rules

Pure functions in utils/, unit tested. Use them in your backend too if you want the same answers.

fileKind()

The kind of a file.

utils/files.ts
fileKind(name: string, kinds: FileKindConfig[]): FileKind

matchesFileFilters()

Whether a file passes the filters.

utils/files.ts
matchesFileFilters(file: FileEntry, filters: FileFilters, kinds: FileKindConfig[], now: number, recentDays: number): boolean

sortFiles()

Sorts files.

utils/files.ts
sortFiles(files: FileEntry[], sort: FileSort): FileEntry[]

folderPath()

The breadcrumb of a folder.

utils/files.ts
folderPath(folders: FileFolder[], folderId: string | null): FileFolder[]

folderDescendants()

Every folder inside a folder.

utils/files.ts
folderDescendants(folders: FileFolder[], folderId: string): string[]

storageBreakdown()

Storage used by kind.

utils/files.ts
storageBreakdown(files: FileEntry[], quota: number, kinds: FileKindConfig[]): { used: number; quota: number; percent: number; kinds: { kind: FileKind; color: string; size: number; percent: number; }[]; }
Returnsusedquotapercentkinds

How it works

  • The page is a BaseSplitView with fixed="detail": sections, root folders and storage in nav, the browser in list and FileManagerFilePanel (preview, rename, details, access and activity) in detail.
  • The browser has the path, search, kind and sort menus, a compact view toggle, a bulk bar, a drop zone, folder tiles and a grid or BaseDataTable list.
  • Cards can be dragged onto a folder to move them. Uploads show their progress in FileManagerUploads.
  • Moving to the trash shows an undo toast; deleting a folder, deleting forever and emptying the trash confirm with useConfirm().
© 2026 melsami UI.
Developer documentation for melsami UI.