Skip to content

FileItem

FileItem is a compound component that renders a single file’s upload state. Compose its named sub-components (FileItem.FileName, FileItem.UploadProgress, FileItem.Actions, etc.) to build custom layouts, or omit children entirely to use the built-in FileItem.Content default.

import { FileItem } from "@hyperserve/video-uploader-react";
<FileItem file={file} layout="row" />

FileItem is a compound component. Use it with its sub-components to build custom file row/card layouts.

sample-video.mp4
50.0 MB
import { FileItem, Thumbnail } from "@hyperserve/video-uploader-react";
<FileItem file={file} layout="column">
<Thumbnail file={file} playback />
<FileItem.FileName />
<FileItem.Meta>
<FileItem.FileSize />
<FileItem.StatusIcon />
</FileItem.Meta>
<FileItem.UploadProgress />
<FileItem.ErrorMessage />
<FileItem.Actions>
<FileItem.RemoveButton />
<FileItem.RetryButton />
</FileItem.Actions>
</FileItem>
PropTypeDefaultDescription
fileFileStaterequiredThe file state object
layout"row" | "column""column"Layout direction
styleCSSPropertiesnoneContainer styles
classNamestringnoneContainer class
stylesFileItemStylesnoneSlot map applied to internal elements (see Slots below)
childrenReactNode | (file) => ReactNodenoneSub-components or render function

All sub-components read from the parent FileItem context. They don’t need explicit props.

Sub-componentDescription
FileItem.FileNameFile name, truncated with ellipsis
FileItem.FileSizeHuman-readable file size
FileItem.ErrorMessageRenders file.error when present
FileItem.RemoveButtonHidden during processing/ready
FileItem.RetryButtonOnly shown when failed
FileItem.StatusIconSpinner during processing, check mark when ready
FileItem.MetaFlex row container for status metadata
FileItem.ActionsFlex column container for action buttons
FileItem.UploadProgressProgress bar, visible only during uploading
FileItem.PlaybackPreviewThumbnail in playback mode, visible only when ready
FileItem.ContentOpinionated default layout combining all sub-components

When children is omitted on FileItem, it renders FileItem.Content, which assembles all sub-components in a sensible default layout that adapts to the layout prop.

Pass a styles slot map to theme every internal element from one prop. Slots merge over defaults; local style props on sub-components win over slots. See Theming for the canonical merge-order explanation.

SlotTargets
rootThe outer card container
contentInnerThe inner wrapper (when using FileItem.Content)
fileNameFileItem.FileName text
fileSizeFileItem.FileSize text
errorMessageFileItem.ErrorMessage div
removeButtonFileItem.RemoveButton button
retryButtonFileItem.RetryButton button
statusIconFileItem.StatusIcon outer span
statusText”Processing…” text inside StatusIcon
metaFileItem.Meta flex row
actionsFileItem.Actions flex column
progressTrackFileItem.UploadProgress track
progressFillFileItem.UploadProgress fill
thumbnailThumbnail rendered by FileItem.Content or PlaybackPreview
<FileItem
file={file}
styles={{
root: { background: "#1e293b" },
fileName: { color: "white" },
}}
>
<FileItem.Content />
</FileItem>

The React Native FileItem exposes the same slots plus two extras for the inner <Text> of its buttons, which web doesn’t need (it uses children text):

  • removeButtonText
  • retryButtonText

FileItem.StatusIcon accepts an additional textStyle prop (the inner “Processing…” span) and a children render prop for full custom rendering:

<FileItem.StatusIcon textStyle={{ fontSize: 10 }} />
<FileItem.StatusIcon>
{({ status, label }) => <CustomBadge status={status}>{label}</CustomBadge>}
</FileItem.StatusIcon>