Skip to content
Wave 3

File Upload

Pick files by clicking, keyboard or drag and drop, with a list of selected files.

  • Avatars or images that need cropping: build a dedicated picker.

Install

Terminal
pnpm dlx shadcn@latest add @acme/file-upload

Or import from the package: import { FileUpload } from '@acme/react'

Examples

Upload basic

Choose files or drag them here

PDF, PNG or JPG, up to 10 MB each.

file-upload-basic.tsx
'use client'

import { FileUpload } from '@/components/ui/file-upload'

export default function FileUploadBasic() {
  return (
    <FileUpload
      className="w-full max-w-md"
      label="Receipts"
      description="PDF, PNG or JPG, up to 10 MB each."
      accept=".pdf,image/png,image/jpeg"
      multiple
      maxSizeMb={10}
      name="receipts"
    />
  )
}

Props

File Upload props
PropTypeDefaultDescription
label (required)string—Visible label; names the file input.
descriptionstring—Allowed types and sizes.
acceptstring—Accepted file types.
multiplebooleanfalseAllow several files.
maxSizeMbnumber—Reject larger files with an error.
namestring—Form field name.
onFilesChange(files: File[]) => void—Called when the selection changes.

Accessibility

Keyboard
KeyAction
TabFocuses the drop area (the file input)
Enter / SpaceOpens the file picker
Role
file input
You provide
  • label (enforced by TypeScript).
Built in
  • Drag and drop is optional; the native file input covers the area (WCAG 2.5.7).
  • Size errors are announced with role="alert" and linked to the input.
  • Each selected file has a named remove button.
WCAG 2.2 criteria
1.3.1, 2.1.1, 2.5.7, 3.3.1

Don’t

  • Hide the allowed types and size until after an error.

Tokens

  • color.input
  • color.primary
  • color.accent
  • color.destructive
  • radius.lg