Skip to content
GitHub

File Upload

A component that allows users to upload files.

Drop files here
or
You can upload up to 2 files at a time.

Installation

Usage

Examples

Multiple Files

Use the maxFiles prop to allow uploading multiple files at once.

Drop files here
or
You can upload up to 5 files at a time.

Trigger only

Dropzone only

Use FileUploadDropzone to enable drag-and-drop. It exposes a data-dragging attribute for styling the drag state.

Drop your files here

Accepted Files

Use the accept prop to restrict file types.

Drop your images here
Only PNG and JPEG formats are allowed.

With Field

Use <Field /> to add helper text and error handling.

Custom Preview

Drop files here

Media Capture

Use the capture prop to capture and upload media directly from the device camera.

The capture prop is only supported on mobile devices.

Directory Upload

Use the directory prop to upload entire folders.

Attention: Directory Upload

When uploading directories with many files, set maxFiles to a higher value or remove it entirely to prevent rejections.

Clear Trigger

Use <FileUploadClearTrigger /> to remove all uploaded files at once.

Drop files here

Custom spacing

Use [--space:--spacing("value")] on <FileUploadDropzone /> to adjust dropzone padding (default --spacing(8)).

Drop your files here

API Reference

FileUpload

Root component. Manages file state and wraps the upload UI.

FileUploadTrigger

Opens the native file picker on click.

FileUploadDropzone

Drop zone for drag-and-drop. Exposes data-dragging when files are dragged over.

FileUploadDropzoneIcon

Icon shown in the dropzone (e.g. upload icon).

FileUploadTitle

Title text for the dropzone (e.g. "Drag files here").

FileUploadDescription

Description or hint for the dropzone.

FileUploadHelper

Helper text (e.g. file types, size limits).

FileUploadList

Pre-built list of uploaded files with previews, names, sizes, and delete buttons. Hidden when empty.

FileUploadItemGroup

List of uploaded files.

FileUploadItem

Single uploaded file with preview and remove button.

FileUploadItemPreview

Preview container for a file.

FileUploadItemPreviewImage

Image thumbnail for image files. Use inside FileUploadItemPreview with type="image/*".

FileUploadItemName

Shows the file name.

FileUploadItemSize

Shows the formatted file size (e.g. "1.2 MB").

FileUploadItemDeleteTrigger

Removes a single file from the list.

FileUploadClearTrigger

Removes all files from the list.

useFileUploadContext

Hook to access file upload state and methods. Use inside FileUpload or FileUploadRootProvider.


For a complete list of props, see the Ark UI documentation.