BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/retab-ui/file-thumbnail

File Thumbnail

retab-ui/file-thumbnail
FreeComponent

Render complete file thumbnails from browser files, URLs, blobs, text sources, external images, or custom preview content.

Install it

npx shadcn@latest add https://ui.retab.com/r/file-thumbnail.json

Source

registry/new-york-v4/ui/file-thumbnail.tsxui.retab.com/r/file-thumbnail.json
1"use client";
2
3import type { ViewerSource } from "@/lib/viewer-source";
4import { GeneratedFileThumbnail } from "@/components/file-thumbnail/generated-preview";
5
6import {
7 FileThumbnailFrame,
8 FileThumbnailShimmer,
9 hasRenderablePreviewContent,
10 resolveFileThumbnailState,
11} from "./file-thumbnail-frame";
12import type {
13 FileThumbnailFrameProps,
14 FileThumbnailProps,
15 FileThumbnailShape,
16 FileThumbnailSize,
17 FileThumbnailSource,
18 FileThumbnailState,
19 ThumbnailFile,
20} from "./file-thumbnail-types";
21
22export {
23 FileThumbnailFrame,
24 FileThumbnailShimmer,
25 hasRenderablePreviewContent,
26 resolveFileThumbnailState,
27};
28export type {
29 FileThumbnailFrameProps,
30 FileThumbnailProps,
31 FileThumbnailShape,
32 FileThumbnailSize,
33 FileThumbnailSource,
34 FileThumbnailState,
35 ThumbnailFile,
36};
37
38/**
39 * Render a complete file thumbnail from a browser File, a viewer source, an
40 * externally generated image, custom preview content, or plain file metadata.
41 */
42export function FileThumbnail({
43 source,
44 file,
45 as,
46 anchor,
47 presentation = "document",
48 retryKey,
49 onError,
50 ...frameProps
51}: FileThumbnailProps) {
52 const resolvedSource = resolveFileThumbnailSource(source, file);
53 const accessibilityProps =
54 presentation === "decorative"
55 ? ({
56 "aria-hidden": true,
57 role: "presentation",
58 } as const)
59 : {};
60 const {
61 previewClassName: _previewClassName,
62 previewContent: _previewContent,
63 previewImageUrl: _previewImageUrl,
64 onPreviewError: _onPreviewError,
65 state: _state,
66 ...thumbnailProps
67 } = frameProps;
68
69 if (shouldUseFrame(frameProps) || !resolvedSource) {
70 return (
71 <FileThumbnailFrame
72 {...frameProps}
73 {...accessibilityProps}
74 file={file ?? fileFromSource(resolvedSource)}
75 />
76 );
77 }
78
79 return (
80 <GeneratedFileThumbnail
81 {...thumbnailProps}
82 {...accessibilityProps}
83 source={resolvedSource}
84 as={as}
85 anchor={anchor ?? "top-left"}
86 retryKey={retryKey}
87 onError={onError}
88 />
89 );
90}
91
92function shouldUseFrame({
93 previewContent,
94 previewImageUrl,
95 state,
96}: Pick<
97 FileThumbnailProps,
98 "previewContent" | "previewImageUrl" | "state"
99>): boolean {
100 return (
101 hasRenderablePreviewContent(previewContent) ||
102 Boolean(previewImageUrl) ||
103 state !== undefined
104 );
105}
106
107function resolveFileThumbnailSource(
108 source: FileThumbnailProps["source"],
109 file: FileThumbnailProps["file"],
110): ViewerSource | null {
111// … truncated

What it pulls in

npm packages

  • @e965/xlsx@0.20.3
  • dompurify@^3.3.3
  • marked@^15.0.12
  • @kenjiuno/msgreader@^1.28.0
  • pptxviewjs@1.1.9
  • utif@^3.1.0
  • docx-preview@^0.3.7

Other registry items

  • @retab/file-thumbnail-frame
  • @retab/pdf-document-resource
  • @retab/docx-document-resource
  • @retab/csv
  • @retab/xlsx-worker-protocol
  • @retab/utils
  • @retab/pptx-viewer

Files it writes

  • registry/new-york-v4/ui/file-thumbnail.tsx
  • registry/new-york-v4/ui/file-thumbnail-types.ts
  • components/file-thumbnail/descriptor.ts
  • components/file-thumbnail/errors.tsx
  • components/file-thumbnail/generated-preview.tsx
  • components/file-thumbnail/keys.ts
  • components/file-thumbnail/renderer-registry.tsx
  • components/file-thumbnail/thumbnail-cache.ts
  • components/file-thumbnail/thumbnail-client-preview.tsx
  • components/file-thumbnail/thumbnail-decode-queue.ts
  • components/file-thumbnail/thumbnail-direct-image.tsx
  • components/file-thumbnail/thumbnail-error-state.ts
  • components/file-thumbnail/thumbnail-errors.ts
  • components/file-thumbnail/thumbnail-in-view.ts
  • components/file-thumbnail/thumbnail-limits.ts
  • components/file-thumbnail/thumbnail-options.ts
  • components/file-thumbnail/thumbnail-profile.ts
  • components/file-thumbnail/thumbnail-resource.ts
  • components/file-thumbnail/thumbnail-test-reset.ts
  • components/file-thumbnail/thumbnail-text.ts
  • components/file-thumbnail/thumbnail-worker-client.ts
  • components/file-thumbnail/types.ts
  • components/file-thumbnail/renderers/csv-thumbnail.tsx
  • components/file-thumbnail/renderers/docx-thumbnail.tsx
  • components/file-thumbnail/renderers/html-thumbnail.tsx
  • components/file-thumbnail/renderers/image-thumbnail.tsx
  • components/file-thumbnail/renderers/layout.tsx
  • components/file-thumbnail/renderers/markdown-thumbnail.tsx
  • components/file-thumbnail/renderers/msg-thumbnail.tsx
  • components/file-thumbnail/renderers/pdf-thumbnail.tsx
  • components/file-thumbnail/renderers/pptx-thumbnail.tsx
  • components/file-thumbnail/renderers/text-thumbnail.tsx
  • components/file-thumbnail/renderers/tiff-thumbnail.tsx
  • components/file-thumbnail/renderers/use-object-url.ts
  • components/file-thumbnail/renderers/xlsx-thumbnail.tsx
  • components/file-thumbnail-tiff.worker.ts
  • components/file-thumbnail-xlsx.worker.ts
  • components/file-thumbnail/renderers/code-thumbnail.tsx
  • components/file-thumbnail/thumbnail-code.ts
  • registry/new-york-v4/ui/utif.d.ts

Facts

Registry
retab-ui
Type
registry:ui
Access
Free
Files written
46
Licence
NOASSERTION
First indexed
2026-08-03
Last confirmed
yesterday

Go to the source

ui.retab.com retab-dev/retab-ui on GitHub Raw registry item This item as JSON

More from retab-ui

All 130 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Alertalertretab-uiComponentsFree1 dep
Alert Dialogalert-dialogretab-uiComponentsFree1 dep
Aspect Ratioaspect-ratioretab-uiComponentsFreeno deps
Attachment Sidebarattachment-sidebarretab-uiComponentsFree1 dep
Autocompleteautocompleteretab-uiComponentsFree2 deps
Calendarcalendarretab-uiComponentsFree2 deps
Code Viewercode-viewerretab-uiComponentsFree2 deps · 32 files
Commandcommandretab-uiComponentsFree2 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex