CnFilePreview
An in-page preview of a data file the Nextcloud Viewer does not show. A CSV or TSV renders as a table of its first 100 rows with the first row as header, JSON as a read-only formatted view, and XML or plain text as text. It fetches at most the first megabyte (Range: bytes=0-1048575), offers Download and Open in Files, and renders every cell as text, never as HTML. A file that cannot be read as a table (for example a CSV with unbalanced quotes) shows its raw text with a sentence saying so.
You rarely mount it yourself: CnFilesTab, CnFilesCard, CnFilesWidget and CnRelatedFiles open it through useFileOpener when the Viewer cannot show the type.
<CnFilePreview
v-if="file"
:file="{ name: 'Afvalinzameling 2025.csv', accessUrl: '/s/abc/download', id: 12, size: 3200000 }"
@close="file = null" />
The file needs a content URL (accessUrl, downloadUrl or url, validated by safeHref). id enables Open in Files; size lets the row count say "about N rows" for a long file.
Props
| Prop | Default | Description |
|---|---|---|
file | required | The file row. |
maxRows (max-rows) | 100 | Rows shown for a CSV or TSV, the header excluded. |
maxBytes (max-bytes) | 1048576 | Bytes fetched at most. |
dialog | true | Wrap the preview in a dialog; false embeds it. |
OpenRegister reliance
medium: this component relies on OpenRegister for part of what it does. 0 direct references, 6 files reached through imports.
See the reliance overview for the filterable list.
Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
file | union | ✓ | — | The file row: name, a content URL (accessUrl, downloadUrl or url), optionally type (mime), size and id (for Open in Files). |
maxRows | number | 100 | Rows shown for a CSV or TSV, the header excluded. | |
maxBytes | number | 1048576 | Bytes fetched at most. | |
dialog | boolean | true | Wrap the preview in a dialog. Pass false to embed it. |
Events
| Name | Payload | Description |
|---|---|---|
close | — | Emitted when the dialog is closed. |