Skip to content

Thumbnail

Thumbnail renders a file’s visual preview, a browser-generated image thumbnail on web, or a placeholder icon when none is available. Set playback to render a <video> element when the file status is "ready" and a playbackUrl exists.

sample-video.mp4Thumbnail
Placeholder
import { Thumbnail } from "@hyperserve/video-uploader-react";
// With thumbnailUri: renders the preview image
<Thumbnail file={file} />
// Without thumbnailUri: renders the placeholder icon
<Thumbnail file={fileWithNoPreview} />
// Renders a <video> element when file.status is "ready" and playbackUrl is set
<Thumbnail file={file} playback />
PropTypeDefaultDescription
fileFileStaterequiredThe file state object
playbackbooleanfalseRender a <video> element when file.playbackUrl is available
controlsbooleantrueShow native video controls (only applies in playback mode)
styleCSSPropertiesnoneContainer styles
classNamestringnoneContainer class
placeholderStyleCSSPropertiesnoneStyles for the placeholder container
placeholderClassNamestringnoneClass for the placeholder container
placeholderReactNodenoneCustom placeholder content (replaces the default icon)
stylesThumbnailStylesnoneSlot map applied to internal elements (see Slots below)
children(info) => ReactNodenoneRender function receiving { thumbnailUri, playbackUrl, isReady }
  • Shows the thumbnail from file.thumbnailUri (generated on file add, web only)
  • When playback is true and the file is ready, renders a <video> element with the playbackUrl
  • Shows a placeholder icon when no thumbnail is available

On React Native, the same playback and controls props apply, but the player is rendered with expo-video’s VideoView. expo-video is an optional peer dependency; when it is not installed, the component falls back to the thumbnail image.

Pass a styles slot map to theme internal elements. Slots merge over defaults; local style/placeholderStyle props win over slots. See Theming for the canonical merge-order explanation.

SlotTargets
imageThe <img> element (and <video> element in playback mode)
placeholderThe placeholder container shown when no thumbnail is available
<Thumbnail
file={file}
styles={{
placeholder: { background: "#0f172a", color: "#475569" },
}}
/>