Sections
File Thumbnail gives document lists, upload queues, and attachment trays a consistent preview shell. It can render plain image previews and generate first-page thumbnails for PDF, DOCX, and XLSX files when you pass a source, file.source, or file.url.
PDF
DOCX
XLSX
Image

"use client"
import * as React from "react"
import {
FileThumbnail,
type ThumbnailFile,
} from "@/components/ui/file-thumbnail"
type DemoFile = ThumbnailFile & {Installation
pnpm dlx shadcn@latest add https://ui.extend.ai/r/file-thumbnail.json
Document Previews
The registry install includes the renderer dependencies used by the component:
react-pdfandpdfjs-distfor first-page PDF thumbnails.@extend-ai/react-docxfor first-page DOCX thumbnails.@extend-ai/react-xlsxfor first-sheet XLSX thumbnails.
Pass a File, Blob, or URL string through source, file.source, or file.url. You can still override the generated preview with previewImageUrl or previewContent.
Useful Behaviors
- Installs the PDF, DOCX, and XLSX renderer packages through the registry item.
- Generates first-page thumbnails for image, PDF, DOCX, and XLSX sources.
- Shows a shimmering file-preview state while an external preview is being generated or loaded.
- Fades the preview in after it loads.
- Falls back to a compact file icon when no preview image is available or image loading fails.
- Supports optional metadata for file name, type, size, page count, or processing status.
API Reference
FileThumbnail
The FileThumbnail component renders the reusable thumbnail shell. It accepts externally generated previews and can generate image, PDF, DOCX, and XLSX thumbnails from a source.
| Prop | Type | Default | Required |
|---|---|---|---|
file | ThumbnailFile | File | - | Yes |
className | string | - | No |
previewAspectRatio | number | - | No |
previewClassName | string | - | No |
previewContent | React.ReactNode | - | No |
previewImageUrl | string | null | - | No |
source | string | File | Blob | - | No |
thumbnailWidth | number | - | No |
generationDelayMs | number | 0 | No |
renderDocumentPreview | boolean | true | No |
isLoading | boolean | false | No |
hasError | boolean | false | No |
showMetadata | boolean | true | No |
ThumbnailFile
| Prop | Type | Default | Required |
|---|---|---|---|
name | string | - | Yes |
type | string | - | Yes |
size | string | number | - | No |
source | string | File | Blob | - | No |
url | string | - | No |
Deploy your document processing on Extend
Trusted by Brex, Flatiron, Square, and more.
Extend provides production ready tools to handle your toughest documents.
Deploy on Extend