File upload
A complete file selection flow with constraints, progress, and error feedback.
npx shadcn@latest add @silicon-ui/file-uploadInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/file-uploadManually
Install the dependencies.
npm install lucide-react motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/file-upload/file-upload.tsxcomponents/silicon-ui/file-upload/file-upload.module.css
Install the foundation once per app for the design and motion tokens:
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
Source codetsx
API reference
| Prop | Type | Default |
|---|---|---|
accept | string | — |
disabled | boolean | false |
label | string | "Upload files" |
description | string | "Drop files here or browse from your device." |
multiple | boolean | true |
maxSize | number | — |
value | FileUploadItem[] | — |
onChange | (files: FileUploadItem[]) => void | — |
onUploadUploads 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