Ga naar hoofdinhoud

CnFilesCard

Compact files widget for the pluggable integration registry. Fetches files attached to an OpenRegister object and renders the most recent entries inside a CnDetailCard. Surface-aware shell around the files integration: handles user-dashboard, app-dashboard, detail-page, and single-entity from a single component.

Wraps: CnDetailCard

Try it​

Loading CnFilesCard playground…

Usage​

<CnFilesCard
:register="registerId"
:schema="schemaId"
:object-id="objectId"
surface="detail-page"
@show-all="openFilesTab" />

Pass pre-translated labels when your app handles i18n:

<CnFilesCard
:register="reg"
:schema="schema"
:object-id="id"
:no-files-label="t('myapp', 'No files attached yet')"
:show-all-label="t('myapp', 'Show all')" />

Display props​

PropTypeDefaultNotes
titleString''Override the card title (defaults to the translated label).
maxDisplay (max-display)Number5Maximum rows to render.
collapsibleBooleanfalseWhether the card collapses.
apiBase (api-base)String'/apps/openregister/api'Base API URL.
addableBooleanfalseShow an add button in the card header that attaches picked files to the object.
addLabel (add-label)String"Add file"Pre-translated label of the add button.

Slots​

SlotDescription
actionsHeader actions of the card, e.g. an Add button. Scope: { refresh }, which reads the files again after the host added one.

Reference​

Opening a file​

Each row is a button labelled with the file name; it opens a file through useFileOpener: the Nextcloud Viewer when it handles the type, otherwise an in-page CnFilePreview for CSV, TSV, JSON, XML and text, otherwise the browser for PDF and images, otherwise the Files app. The preview carries Download and Open in Files.

OpenRegister reliance​

medium: this component relies on OpenRegister for part of what it does. 1 direct reference, 7 files reached through imports.

See the reliance overview for the filterable list.

Props​

NameTypeRequiredDefaultDescription
registerstring✓—OpenRegister register id (slug or uuid).
schemastring✓—OpenRegister schema id (slug or uuid).
objectIdstring✓—Parent object id.
surfacestring'detail-page'Rendering surface — passed for AD-19 surface fallback consumers.
apiBasestring'/apps/openregister/api'Base API URL.
maxDisplaynumber5Maximum rows to render.
collapsiblebooleanfalseWhether the card collapses.
titlestring''Override the card title (defaults to the translated label).
noFilesLabelstring() =&gt; t('nextcloud-vue', 'No files attached')Pre-translated empty label.
showAllLabelstring() =&gt; t('nextcloud-vue', 'Show all')Pre-translated overflow label.
addablebooleanfalseShow an add button in the card header that attaches picked files to the object.
addLabelstring() =&gt; t('nextcloud-vue', 'Add file')Pre-translated label of the add button.

Events​

NamePayloadDescription
show-all—User clicked the "show all" footer button — emitted with no payload. Parents typically open the host app's full files view in response.
uploaded—Files were attached to the object. Payload: their names.

Slots​

NameBindingsDescription
actionsrefreshactions Header actions of the card, e.g. an Add button. Scope: