X Enterprises
nuxt-x-app

Document

File management components for uploading, listing, previewing, and managing documents with grid and list views.

Document

The Document category provides a complete file management system — from drag-and-drop upload through grid/list browsing to in-browser preview. Components are composable: use XADocumentManager for a turnkey solution or assemble individual pieces for custom layouts.

Components

<XADocument />

The core orchestration component. Combines an uploader, grid or list view, preview modal, and rename/delete confirmation dialogs. Accepts documents either as a direct array (manual mode) or via an endpoint string that drives useXCrud (auto mode).

<XADocument
  :documents="files"
  view="grid"
  size="md"
  :uploadable="true"
  :downloadable="true"
  :deletable="true"
  :renamable="true"
  :previewable="true"
  :selectable="false"
  accept="image/*,application/pdf"
  :max-size="10 * 1024 * 1024"
  @upload="handleUpload"
  @download="handleDownload"
  @delete="handleDelete"
  @rename="handleRename"
/>

Props

PropTypeDefaultDescription
documentsArray[]Direct array of document objects (manual mode)
endpointStringnullAPI endpoint for CRUD operations (auto mode)
view'grid' | 'list''grid'Display mode
size'sm' | 'md' | 'lg''md'Grid card size
uploadableBooleantrueShow upload zone
downloadableBooleantrueAllow downloads
deletableBooleantrueAllow delete
renamableBooleantrueAllow rename
previewableBooleantrueAllow preview
selectableBooleanfalseEnable multi-select
maxSizeNumber262144000Max file size in bytes (250 MB)
maxFilesNumbernullMax files per upload
acceptString'*'Accepted MIME types or extensions
compactUploaderBooleanfalseUse compact upload zone
disabledBooleanfalseDisable all interactions
loadingBooleanfalseLoading state (manual mode)
showActionsBooleantrueShow action menus on items
emptyIconString'i-lucide-files'Empty state icon
emptyTitleString'No documents'Empty state title
emptyDescriptionString'Upload files to get started.'Empty state description

Emits

EventPayloadDescription
uploadFile[]Files selected for upload
downloadDocumentDocument to download
deleteDocumentDocument deleted
rename{ document, name }Document renamed
previewDocumentDocument to preview
clickDocumentDocument clicked
errorErrorUpload or operation error
update:documentsDocument[]Updated documents array

<XADocumentList />

Table-based document listing with sortable columns (name, size, date), inline preview/download buttons, and a per-row dropdown for rename/delete actions.

<XADocumentList
  :documents="files"
  :loading="isLoading"
  :selectable="true"
  v-model:selected="selectedIds"
  :previewable="true"
  :downloadable="true"
  :renamable="true"
  :deletable="true"
  @preview="openPreview"
  @download="downloadFile"
/>

Props

PropTypeDefaultDescription
documentsArrayrequiredArray of document objects
loadingBooleanfalseShow loading skeleton
selectableBooleanfalseEnable multi-select checkboxes
selectedArray[]Selected document IDs (v-model:selected)
previewableBooleantrueShow preview button
downloadableBooleantrueShow download button
renamableBooleantrueShow rename action
deletableBooleantrueShow delete action
emptyIconString'i-lucide-files'Empty state icon
emptyTitleString'No documents'Empty state title
emptyDescriptionString'Upload files to get started.'Empty state description

Emits

click, preview, download, rename, delete, update:selected


<XADocumentGrid />

Wraps documents in a flex card grid with thumbnail previews for images and file-type icons for other types.

<XADocumentGrid
  :documents="files"
  :loading="isLoading"
  size="md"
  :show-actions="true"
  :selectable="true"
  v-model:selected="selectedIds"
  @click="openDocument"
  @preview="openPreview"
  @delete="deleteDocument"
/>

Props

PropTypeDefaultDescription
documentsArrayrequiredArray of document objects
loadingBooleanfalseShow loading skeleton
size'sm' | 'md' | 'lg''md'Card size variant
showActionsBooleantrueShow action menu on items
selectableBooleanfalseEnable multi-select
selectedArray[]Selected document IDs (v-model:selected)
emptyIconString'i-lucide-files'Empty state icon
emptyTitleString'No documents'Empty state title
emptyDescriptionString'Upload files to get started.'Empty state description

Emits

click, preview, download, rename, delete, update:selected


<XADocumentItem />

Single document card used by XADocumentGrid. Displays a thumbnail (or file-type icon), filename, size, and date. Shows an action dropdown on hover.

<XADocumentItem
  :document="file"
  :selected="isSelected"
  :show-actions="true"
  size="md"
  @click="handleClick"
  @preview="handlePreview"
  @download="handleDownload"
  @rename="handleRename"
  @delete="handleDelete"
/>

Props

PropTypeDefaultDescription
documentObjectrequiredDocument object with id, name, size, type, url
selectedBooleanfalseWhether the item is selected
showActionsBooleantrueShow action menu on hover
size'sm' | 'md' | 'lg''md'Size variant

Emits

click, download, delete, rename, preview


<XADocumentPreview />

A large modal for in-browser document preview. Supports images, PDFs (via iframe), video, and audio. Includes prev/next navigation when a documents array is provided.

<XADocumentPreview
  v-model="previewOpen"
  :document="activeDocument"
  :documents="allDocuments"
  :downloadable="true"
  @download="handleDownload"
  @navigate="setActiveDocument"
/>

Props

PropTypeDefaultDescription
modelValueBooleanfalseControls modal open state (v-model)
documentObjectnullCurrent document to preview
documentsArray[]All documents for prev/next navigation
downloadableBooleantrueShow download button in header

Emits

update:modelValue, download, navigate


<XADocumentUploader />

A styled drag-and-drop upload zone. Validates file count and size before emitting. Shows an upload progress overlay when uploading is true.

<XADocumentUploader
  :multiple="true"
  accept="image/*,application/pdf"
  :max-size="10 * 1024 * 1024"
  :max-files="5"
  :compact="false"
  :uploading="isUploading"
  @upload="handleFiles"
  @error="handleError"
/>

Props

PropTypeDefaultDescription
multipleBooleantrueAllow multiple file selection
acceptString'*'Accepted MIME types or extensions
acceptLabelString''Human-readable accept label shown in UI
maxSizeNumber262144000Max file size in bytes (250 MB)
maxFilesNumbernullMax number of files per upload
compactBooleanfalseCompact mode for smaller spaces
disabledBooleanfalseDisable uploads
uploadingBooleanfalseShow upload progress overlay

Emits

EventPayloadDescription
uploadFile[]Valid files ready for upload
error{ type, message }Validation error (size/count exceeded)

<XADocumentManager />

The highest-level document component. Wraps XADocument inside an XACard with an optional search input, view toggle (grid/list), and a collapsible card. Best choice for embedding a document manager into an entity detail page.

<XADocumentManager
  title="Project Files"
  icon="i-lucide-folder"
  :documents="project.documents"
  view="grid"
  :searchable="true"
  :show-view-toggle="true"
  :features="{
    upload: true,
    download: true,
    delete: canDelete,
    rename: canRename,
    preview: true,
    select: false,
  }"
  :upload-config="{
    maxSize: 25 * 1024 * 1024,
    accept: 'image/*,application/pdf',
    compact: false,
  }"
  @upload="handleUpload"
  @delete="handleDelete"
/>

Props

PropTypeDefaultDescription
titleString'Documents'Card title
descriptionString''Card description
iconString'i-lucide-files'Card icon
collapsibleBooleanfalseMake the card collapsible
collapsedBooleanfalseInitial collapsed state
searchableBooleantrueShow search input in toolbar
showViewToggleBooleantrueShow grid/list toggle in toolbar
documentsArray[]Document array
endpointStringnullAPI endpoint (auto mode)
view'grid' | 'list''grid'Initial view mode
size'sm' | 'md' | 'lg''md'Grid card size
featuresObject{ upload, download, delete, rename, preview: true, select: false }Feature flags
uploadConfigObject{ maxSize: 10MB, maxFiles: null, accept: '*', compact: false }Upload configuration
emptyStateObject{ icon, title, description }Empty state customization
disabledBooleanfalseDisable all interactions
loadingBooleanfalseLoading state
showActionsBooleantrueShow action menus on items

Emits

upload, download, delete, rename, preview, click, error, update:documents, update:view


AI Context

category: Document
package: "@xenterprises/nuxt-x-app"
components:
  - XADocument
  - XADocumentList
  - XADocumentGrid
  - XADocumentItem
  - XADocumentPreview
  - XADocumentUploader
  - XADocumentManager
use-when: >
  Any feature that needs file upload, browsing, and management. Use
  XADocumentManager for entity detail pages (projects, contacts, orders).
  Use XADocument for embedded file sections. Use lower-level components
  (XADocumentList, XADocumentGrid) when you need custom layout control.
key-patterns:
  - XADocumentManager is the recommended entry point for most use cases
  - Pass documents array for manual control; pass endpoint for auto CRUD
  - Feature flags object controls which actions are visible
  - uploadConfig object controls file type and size restrictions
  - XADocumentPreview handles images, PDFs, video, and audio natively
document-object-shape: "{ id, name, size, type, url, thumbnailUrl?, createdAt?, uploadedAt? }"
Copyright © 2026