TypeScript
---
title: File Thumbnail
description: Render compact file preview images with a skeleton, fade transition, and fallback state.
component: true
---
File Thumbnail gives document lists, upload queues, and attachment trays a consistent preview shell. Pass an image URL or renderer output from your PDF, DOCX, XLSX, or image pipeline; the component handles the thumbnail frame, loading shimmer, fade-in, and fallback state.
<FileThumbnailDemo />
## Installation
<CodeTabs>
<TabsList>
<TabsTrigger value="cli">Command</TabsTrigger>
<TabsTrigger value="manual">Manual</TabsTrigger>
</TabsList>
<TabsContent value="cli">
```bash
npx shadcn@latest add @extend/file-thumbnail
```
</TabsContent>
<TabsContent value="manual">
<Steps className="mb-0 pt-2">
<Step>
Copy `components/extend/file-thumbnail.tsx` from the registry item into your
project.
</Step>
<FileThumbnailSource />
<Step>Update the import paths to match your project setup.</Step>
</Steps>
</TabsContent>
</CodeTabs>
## Document Previews
File Thumbnail does not parse documents or install renderer packages. The registry item has no npm dependencies; generate thumbnails with whichever viewer stack you already use, then pass the result through `previewImageUrl` or `previewContent`.
## Useful Behaviors
- Accepts externally generated thumbnails as an image URL or custom React content.
- Shows a shimmering file-preview state while your thumbnail generator is loading.
- Fades the preview in after it loads.
- Falls back to a blank muted preview surface when no preview image is available or image loading fails.
## API Reference
### FileThumbnail
The FileThumbnail component renders the reusable thumbnail shell. It accepts externally generated previews from your own rendering pipeline.
| 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 |
| `isLoading` | `boolean` | `false` | No |
| `hasError` | `boolean` | `false` | No |
### ThumbnailFile
| Prop | Type | Default | Required |
| ------ | -------- | ------- | -------- |
| `name` | `string` | `-` | Yes |
| `type` | `string` | `-` | Yes |