File Upload

Two ways to handle uploads: a queue of files with progress bars, status, retry and remove, and an attachment area that takes files, links, images and audio with previews, size limits and a waveform player.

Attachment Upload

attachment-upload.tsx

A dropzone for mixed attachments: file and image rows that stagger in, upload, done and failed states with retry and remove, image previews that expand smoothly, and audio with a waveform.

File Upload Attachment Upload preview width

Install

$ bunx --bun shadcn add @karaui/attachment-upload
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

value?
AttachmentUploadItem[]
—
defaultValue?
AttachmentUploadItem[]
—
onValueChange?
((items: AttachmentUploadItem[]) => void)
—
onFilesAdded?
((items: AttachmentUploadItem[], files: File[]) => void)
—
onFilesRejected?
((files: File[], reason: AttachmentRejectReason) => void)
—
onRemove?
((item: AttachmentUploadItem) => void)
—
onRetry?
((item: AttachmentUploadItem) => void)
—
playingId?
string
—
onAudioToggle?
((item: AttachmentUploadItem) => void)
—
accept?
string
—
multiple?
boolean
true
maxFiles?
number
12
maxFileSize?
number
500 * 1024 * 1024
disabled?
boolean
false
title?
string
Drag and drop or browse files
description?
string
—
attachmentsLabel?
string
Attachments
className?
string
—
classNames?
AttachmentUploadClassNames
—

Upload Queue

file-upload.tsx

Drop or browse files into a list where each row shows progress and status, with retry for failures and a button to take it out.

File Upload Upload Queue preview width

Install

$ bunx --bun shadcn add @karaui/file-upload

API Reference

value?
FileUploadItem[]
—
defaultValue?
FileUploadItem[]
—
onValueChange?
((items: FileUploadItem[]) => void)
—
onFilesAdded?
((items: FileUploadItem[], files: File[]) => void)
—
onRemove?
((item: FileUploadItem) => void)
—
onRetry?
((item: FileUploadItem) => void)
—
accept?
string
—
multiple?
boolean
true
maxFiles?
number
—
disabled?
boolean
false
variant?
"default" | "centered"
default
title?
string
Drop files here
description?
string
Add files to the upload queue
browseLabel?
string
Browse
className?
string
—
classNames?
FileUploadClassNames
—

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.

Updated