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/upload-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)
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