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
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
| Prop | Type | Default | Notes |
|---|---|---|---|
title | String | '' | Override the card title (defaults to the translated label). |
maxDisplay (max-display) | Number | 5 | Maximum rows to render. |
collapsible | Boolean | false | Whether the card collapses. |
apiBase (api-base) | String | '/apps/openregister/api' | Base API URL. |
addable | Boolean | false | Show 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
| Slot | Description |
|---|---|
actions | Header 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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
register | string | ✓ | — | OpenRegister register id (slug or uuid). |
schema | string | ✓ | — | OpenRegister schema id (slug or uuid). |
objectId | string | ✓ | — | Parent object id. |
surface | string | 'detail-page' | Rendering surface — passed for AD-19 surface fallback consumers. | |
apiBase | string | '/apps/openregister/api' | Base API URL. | |
maxDisplay | number | 5 | Maximum rows to render. | |
collapsible | boolean | false | Whether the card collapses. | |
title | string | '' | Override the card title (defaults to the translated label). | |
noFilesLabel | string | () => t('nextcloud-vue', 'No files attached') | Pre-translated empty label. | |
showAllLabel | string | () => t('nextcloud-vue', 'Show all') | Pre-translated overflow label. | |
addable | boolean | false | Show an add button in the card header that attaches picked files to the object. | |
addLabel | string | () => t('nextcloud-vue', 'Add file') | Pre-translated label of the add button. |
Events
| Name | Payload | Description |
|---|---|---|
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
| Name | Bindings | Description |
|---|---|---|
actions | refresh | actions Header actions of the card, e.g. an Add button. Scope: |