Skip to content

File upload

A complete file selection flow with constraints, progress, and error feedback.

npx shadcn@latest add @silicon-ui/file-upload

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/file-upload

Manually

  1. Install the dependencies

    npm install lucide-react motion
  2. Copy these files into your project

    • components/silicon-ui/file-upload/file-upload.tsx
    • components/silicon-ui/file-upload/file-upload.module.css
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { FileUpload } from "@/components/silicon-ui/file-upload/file-upload";

API reference

PropTypeDefault
acceptstring—
disabledbooleanfalse
labelstring"Upload files"
descriptionstring"Drop files here or browse from your device."
multiplebooleantrue
maxSizenumber—
valueFileUploadItem[]—
onChange(files: FileUploadItem[]) => void—
onUpload

Uploads each accepted file. Report progress from 0 to 100, resolve when done, or reject to mark the file as failed. Removing a file aborts its signal.

(file: File, options: { onProgress: (percent: number) => void; signal: AbortSignal }) => Promise<void>—

Dependencies

npm
lucide-reactmotion
Registry
silicon-motion-tokens