Skip to content
Mizen UI
Docs

IntroductionInstallationCLIStylingFoundationsThemingCompositionIntegrationsAccessibilityFor agents

useCopyToClipboard

AccordionAspect RatioCardCollapsibleFrameGridGroupInlineScroll AreaSectionSeparatorSpacerStack

BlockquoteCitationCodeHeadingKbdLabelLinkTextVisually Hidden

ButtonButton GroupToggleToggle groupToolbar

CalendarCheckboxCheckbox groupComboboxDate pickerDate range pickerDate-Time InputFieldFieldsetFile UploadFormInputInput groupNumber fieldOTP FieldRadio groupSelectSliderSwitchTextareaTime Input

BreadcrumbMenubarNavigation MenuPaginationSegmented ControlStepperTabs

Alert dialogCommandContext MenuDialogDrawerMenuPopoverPreview CardSheetTooltip

AlertBadgeEmptyError StateMeterProgressSkeletonSpinnerStatus dotToast

Activity FeedAvatarAvatar GroupData TableListMetricOverflow ListProperty ListTableTokenTree

Area ChartBar ListCalendar HeatmapCategory ComparisonChart FrameChart LegendChart TooltipDistributionFunnelHeatmapMetric TrendPart-to-WholeProgress RingsRadar ChartRadial BarsSankey ChartScatter ChartScore GaugeTime Series

Diagram

AttachmentCarouselCode BlockLightboxMarkdownThumbnailTimestamp

Agent ThinkingApproval CardComposerConversationInline CitationMessageMessage ScrollerQuestion CardSourcesStreaming TextSuggestionTask ListTerminalTool Call

On this page

  • Preview
  • Usage
  • Anatomy
  • Examples
  • Drag and drop files here
  • Error and retry
  • Disabled upload
  • Recommendations
  • Usage boundaries
  • API reference

Forms

File Upload

Uploads files via drag-and-drop or system file picker with validation, status presentation, and removal. Applications own transport and retries.

idle

Usage

import {
	FileUpload,
	FileUploadDropzone,
	FileUploadInput,
	FileUploadItem,
	FileUploadItemName,
	FileUploadItemPreview,
	FileUploadItemProgress,
	FileUploadItemRemove,
	FileUploadItemSize,
	FileUploadItemStatus,
	FileUploadList,
	FileUploadTrigger,
} from "@mizen-labs/ui";

Anatomy

The parts and how they nest, taken from the preview above.

<FileUpload>
	<FileUploadDropzone>
		<FileUploadTrigger />
	</FileUploadDropzone>
	<FileUploadInput />
	<FileUploadList>
		<FileUploadItem>
			<FileUploadItemPreview />
			<FileUploadItemName />
			<FileUploadItemSize />
			<FileUploadItemStatus />
			<FileUploadItemRemove />
			<FileUploadItemProgress />
		</FileUploadItem>
	</FileUploadList>
</FileUpload>

Examples

Drag and drop files here

Error and retry

Simulates a failed upload. Retry the same file without selecting it again.

Disabled upload

Enable selection, then disable the selected upload to check paused progress and blocked actions.

Recommendations

GuidancePractice
Do

Show accepted formats and size limits before selection. Keep rejection reasons and progress beside each file.

Usage boundaries

GuidanceBoundary
Scope

The application owns transport, cancellation, and retries. Validate file content and limits on the server.

API reference

Public props from @mizen-labs/ui. Use exported prop types for the complete TypeScript contract.

PropTypeDefaultDescription
acceptstring—Accepted file types specifier string matching file extensions or MIME patterns.
defaultValuereadonly File[][]Initial files array for uncontrolled file upload presentation.
disabledbooleanfalseDisables user interaction across picker trigger, dropzone, and remove actions.
maxFilesnumber1Maximum number of files allowed in the upload collection.
maxSizenumber—Maximum allowed file size in bytes for each uploaded file.
namestring—Field name submitted with form data on the synchronized native file input.
valuereadonly File[]—Controlled array of files.
onValueChange(files: readonly File[], details: FileUploadChangeDetails) => void—Callback fired when files are added, dropped, or removed with change details.
onFileReject(rejections: readonly FileRejection[]) => void—Callback fired when files are rejected due to type, size, or count constraints.
FileUploadFileUploadProps"div"Root container providing file upload context, drag-and-drop coordination, and accessibility announcements.
FileUploadDropzoneFileUploadDropzoneProps"div"Non-interactive drag-and-drop surface receiving files without pretending to be keyboard-focusable.
FileUploadInputFileUploadInputProps"input"Visually hidden native input element synchronized with selected files for form submission.
FileUploadTriggerFileUploadTriggerProps"button"Accessible button element opening the native system file picker.
FileUploadListFileUploadListProps"ul"List container supporting children or a render function. Set layout="tiles" for a horizontal attachment strip; defaults to rows.
FileUploadItemFileUploadItemProps"li"Scopes file data and index for an item. Set layout="upload" for a compact upload card, or layout="tile" for compact attachments. Defaults to row.
FileUploadItemPreviewFileUploadItemPreviewPropsOptionalShows a local image preview with object URL cleanup. Children provide the document or failed-image fallback.
FileUploadItemNameFileUploadItemNameProps"span"Displays the file name with automatic ellipsis truncation.
FileUploadItemSizeFileUploadItemSizeProps"span"Displays the formatted file size with tabular figures.
FileUploadItemStatusFileUploadItemStatusProps"span"Renders and announces pending, uploading, success, or error states. Error status also marks the file card border.
FileUploadItemProgressFileUploadItemProgressProps"div"Renders a standard progress bar inside each file card. Applications own transport and progress updates.
FileUploadItemRemoveFileUploadItemRemoveProps"button"Accessible button to remove a file from the list with focus restoration.
PreviousFieldsetNextForm

Drop files here

Images or PDF up to 5 MB (maximum 3 files)

    Drop files here

    Images or PDF up to 5 MB (maximum 3 files)

      Files stay in this browser example; no upload starts.

      Drop files here

      Images or PDF up to 5 MB (maximum 3 files)

        Drop files here

        Images or PDF up to 5 MB (maximum 3 files)