FileUpload (drop area), FileCard (one file with status), FileFormatIcon, ImageUpload (avatar or logo) and UploadSource.
Default
A drop area; chosen files appear below as cards.
Installation
Copies the component into src/design-system/ as your own source, with only the files it needs.
npx avesk-ui@latest add file-uploadBrings the 2 files it builds on (button.tsx, glyph.tsx). The first time, it also adds the tokens and the cn() helper, imports the tokens in globals.css and installs clsx and tailwind-merge. Files already in your project are kept unless you add --force.
Import
Lives in src/design-system/components/file-upload.tsx.
import { formatBytes, fileFormatFor, FileFormatIcon, FileUpload, UploadSource, FileCard, ImageUpload } from "@/design-system/components/file-upload";Usage
<FileUpload accept=".pdf,image/*" maxSize={50 * 1024 * 1024} hint="PDF or images, up to 50 MB." onFiles={add} />
<FileCard name="brief.pdf" size={122880} progress={40} status="uploading" onRemove={cancel} />Examples
File cards
One card per file: uploading with progress, completed, and failed with a retry.
Denzing-logo-concepts.fig
3.4 MB of 8 MBUploading…
Brand-refresh-proposal.pdf
94 KB of 94 KBCompleted
Moodboard-final.png
0 B of 3.1 MBUpload failed
Image upload
Profile picture or client logo: Upload when empty, Change and Remove once set.
Client logo
Square PNG or JPEG, at least 400×400px.
Circle and disabled
shape="circle" for avatars, and a disabled drop area.
Format icons
Page icons with a coloured label for each file type, in two sizes.
When to use
Use it when
- Attaching files to a project or brief (FileUpload + FileCard)
- Setting a profile picture or company logo (ImageUpload)
- Showing a file's type in a list (FileFormatIcon)
Don’t use it when
- Pasting a link to a file → Field and inputs (Input type=url)
Rules
- The component never uploads: the screen sends files and feeds progress and status into FileCard
- Always state accepted formats and the size limit in hint
Properties
FileFormatIcon
| Prop | Type | Default |
|---|---|---|
label | string | "PDF" |
color | "red" | "orange" | "yellow" | "green" | "sky" | "blue" | "purple" | "pink" | "gray" | "red" |
size | "sm" | "md" | "md" |
className | string | – |
FileUpload
| Prop | Type | Default |
|---|---|---|
id | string | – |
accept | string | "image/png,image/jpeg" |
maxSize | number | – |
multiple | boolean | false |
disabled | boolean | false |
title | ReactNode | "Choose a file or drag & drop it here." |
hint | ReactNode | "Min 400×400px, PNG or JPEG" |
icon | ReactNode | – |
buttonLabel | string | null | "Browse File" |
shape | "box" | "circle" | "box" |
children | ReactNode | – |
onFiles * | (files: File[]) => void | – |
onReject | (files: RejectedFile[]) => void | – |
aria-describedby | string | – |
className | string | – |
FileCard
| Prop | Type | Default |
|---|---|---|
name * | string | – |
size * | number | – |
progress | number | 0 |
status * | "uploading" | "complete" | "error" | – |
error | string | – |
onRemove | () => void | – |
onRetry | () => void | – |
className | string | – |
ImageUpload
| Prop | Type | Default |
|---|---|---|
src | string | null | – |
kind | "person" | "company" | "person" |
title | string | "Upload image" |
hint | string | "Min 400×400px, PNG or JPEG" |
compact | boolean | false |
accept | string | "image/png,image/jpeg" |
disabled | boolean | false |
onUpload * | (file: File) => void | – |
onRemove | () => void | – |
className | string | – |
* required
Accessibility
- Real file input; Enter or Space opens the picker; FileCard progress is a progressbar