Skip to content
satin

File upload

Takes files by drop or browse, shows each upload and what failed, then the attached files.

Drop files here

PDF, images, CSV · up to 10 MB

Installation

Terminal
npm i @uisatin/ui
Import
import { FileUpload, type FileUploadFile } from '@uisatin/ui/file-upload'

About 38.1 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.

First time with Satin? Set it up once, styles and fonts included, with the installation guide.

API Reference

The FileUpload component renders a drop zone with a Browse files button over a hidden <input type="file">, then a list of the files the app is handling. Dropped and picked files are checked against accept and maxSize; the upload itself is yours, kept in files.

PropTypeDefault
files
FileUploadFile[]
[]
accept
string
—
maxSize
number
—
multiple
boolean
true
disabled
boolean
false
title
ReactNode
"Drop files here"
dropTitle
ReactNode
"Drop to upload"
description
ReactNode
—
browseLabel
string
"Browse files"
onBrowse
() => void
—
onFilesAdded
(files: File[]) => void
—
onFilesRejected
(rejections: FileUploadRejection[]) => void
—
onCancel
(file: FileUploadFile) => void
—
onRemove
(file: FileUploadFile) => void
—
onOpen
(file: FileUploadFile) => void
—
className
string
—
ref
Ref<HTMLDivElement>
—
...props
ComponentProps<'div'>

Other attributes go to <div>

—

Accessibility

Dropping files works by pointer only; Browse files is a native button that opens the file picker, described by description, so keyboard users get the same path. The rows are lists named "Files" and "Attached files". An uploading row has a Progress named "Uploading <name>" and a "Cancel <name>" button; an error row is role="alert", so it is read out when it appears, with a "Remove <name>" button. Rejected files are only reported to onFilesRejected; show them as error rows so they are announced.

KeyAction
EnterorSpaceOn Browse files: opens the file picker.