Ga naar hoofdinhoud

CnFilesPage

A file-browser / document page. v1 lists the contents of folder in a simple CnDataTable (consumer-supplied data) plus an "Open in Files" button that deep-links to the Nextcloud Files app.

Mounted automatically by CnPageRenderer when a manifest page declares type: "files". Honours headerComponent, actionsComponent, and a fully-replaceable #files-view slot for consumers wanting the full NC Files file-picker UX.

Wraps: CnDataTable, CnPageHeader, NcButton, NcEmptyContent, NcLoadingIcon.

Props

PropTypeDefaultDescription
titleString'Files'Page title
descriptionString''Subtitle shown under the title when showTitle is set
showTitleBooleanfalseWhether to render the inline CnPageHeader
iconString''MDI icon name
folderStringrequiredFolder path within the user's Nextcloud filesystem
allowedTypesArray<String>[]MIME-type filter. Literal ('application/pdf') or wildcard ('image/*').
filesArray<Object>[]Pre-loaded file listing from the consumer (each: { name, path, size, mtime, mime })
loadingBooleanfalseWhether a fetch is in progress
errorError|String|ObjectnullTruthy → error state
emptyTextString'No files in this folder'Empty-state text
errorTextString'Could not load folder contents'Error-state text
openInFilesLabelString'Open in Files'Button label
onRefreshFunctionnullOptional refresh callback wired into the slot scope and the public refresh() method

Slots

SlotScopeDescription
header{ title, description, icon }Replaces the default CnPageHeader
actionsRight-aligned actions; defaults to the "Open in Files" button. Filled by pages[].actionsComponent when set.
files-view{ folder, allowedTypes, files, loading, error, refresh }Replaces the entire default listing — the bridge to the full NC Files view or a consumer-supplied WebDAV component
emptyReplaces the empty-state
error{ error }Replaces the error state

Manifest configuration

{
"id": "files-browser",
"route": "/files",
"type": "files",
"title": "myapp.files.title",
"config": {
"folder": "/myapp/uploads",
"allowedTypes": ["application/pdf", "image/*"]
}
}

Custom-fallback notes

  • No bundled WebDAV client. The component does NOT fetch the folder listing on its own — it expects either a consumer-supplied files prop, or a #files-view slot that brings its own data fetch (e.g. via the consumer's existing filesPlugin). When neither is set, the empty-state renders. This keeps @conduction/nextcloud-vue zero-dep on webdav.
  • No upload, no rename, no delete. v1 ships a read-only listing. Use the "Open in Files" button (links to /apps/files/files?dir={folder}) for the full UX, or fill the #files-view slot with a custom file picker (e.g. wrapping OC.dialogs.filepicker).
  • allowedTypes only filters the default listing. Custom #files-view implementations are responsible for honouring the prop themselves; the slot scope exposes the array for that purpose.
  • The "Open in Files" button uses /apps/files/files?dir={dir} — the URL shape is stable on Nextcloud 26+. Older releases need a custom #actions slot.
  • Future integration with pluggable-integration-registry: per design.md Q4, once the files provider ships in OpenRegister, this component will gain a built-in fetcher that talks to that registry. Until then, consumers carry the fetch responsibility.