Skip to content

StatusBadge

StatusBadge renders a colored pill label for a FileStatus. Override colors and labels per status with statusConfig, or drop into headless mode with the children render function.

SelectedValidatingUploadingProcessingReadyFailed
import { StatusBadge } from "@hyperserve/upload-react";
<StatusBadge status={file.status} />
PropTypeDefaultDescription
statusFileStatusrequiredThe file status
statusConfigPartial<Record<FileStatus, StatusConfigEntry>>nonePer-status overrides for colors/labels
getLabel(status: FileStatus) => stringnoneCustom label function
children(info) => ReactNodenoneHeadless render function
styleCSSPropertiesnoneContainer styles
classNamestringnoneContainer class

Override colors and labels per status:

QueuedIn ProgressEncodingPublishedFailed
const statusConfig = {
selected: { bg: "#fef9c3", text: "#713f12", label: "Queued" },
uploading: { bg: "#dbeafe", text: "#1e40af", label: "In Progress" },
processing: { bg: "#ede9fe", text: "#5b21b6", label: "Encoding" },
ready: { bg: "#d1fae5", text: "#065f46", label: "Published" },
failed: { bg: "#fee2e2", text: "#991b1b", label: "Failed" },
};
<StatusBadge status="selected" statusConfig={statusConfig} />
<StatusBadge status="uploading" statusConfig={statusConfig} />
<StatusBadge status="processing" statusConfig={statusConfig} />
<StatusBadge status="ready" statusConfig={statusConfig} />
<StatusBadge status="failed" statusConfig={statusConfig} />

Use the children render function for complete control:

SelectedUploadingProcessingReadyFailed
<StatusBadge status={file.status}>
{({ label, color }) => (
<span style={{ color, fontWeight: 600 }}>{label}</span>
)}
</StatusBadge>