File upload

File upload is a neobrutalist React component from Cruise UI. A drag-and-drop zone that's also a button, with a file list, thumbnails, progress and remove. Install it with npx shadcn@latest add @cruiseui/file-upload.

Install

Terminal

npx shadcn@latest add @cruiseui/file-upload

First time? Installation shows the one-off components.json setup (the @cruiseui registry) and how to turn the theme on.

Example

Corners

Up to 3 photos.

When to use it

When to use

Photos, receipts and documents in a form.

When not to

Pasting a link to a file (use an Input).

Props

CruiseFileUpload

PropTypeDefaultDescription
label?string—Visible label. Leave out inside a CruiseFormField (it brings the label).
hint?string——
error?string—Your own error; size, type and count errors are added for you.
required?boolean——
accept?string—e.g. "image/*,.pdf"
maxSize?number—In bytes, e.g. 5 * 1024 * 1024.
multiple?booleanfalse—
maxFiles?number——
disabled?boolean——
name?string——
id?string——
onFilesChange?((files: File[]) => void)—Called with the accepted files whenever the list changes.
uploader?((file: File, report: (percent: number) => void) => Promise<void>)—Uploads one file; call report(0-100) as it goes. Throw to fail it.
className?string——

Accessibility

  • The zone is a <label> for a real file input: click, Enter or Space opens the picker.
  • Size, type and count errors show in words through the Form field.
  • Each file has a "Remove photo.jpg" button and a labelled progress bar.