Overview
Accessible shadcn components for uploading, downloading, deleting, and browsing files stored in S3.
@dimah-s3/ui is a set of
accessible React components for file uploads and stored files. They render the
@dimah-s3/react hooks, follow your
shadcn theme, and install as an npm package or as
source code you own through the shadcn registry.
Drag and drop files here
You can upload 4 files. Each up to 75.0 MB.
Components
Upload
Upload
Button, dropzone, progress, and toasts for any upload flow.
Upload Field
Form field that submits the object keys of its uploads.
Avatar Upload
Image button that shows a picture and uploads a new one.
Files
Object List
File browser with folders, search, sort, selection, and upload.
Object Card
One stored file with download and delete actions.
Object Image
An <img> for a private object, signed and refreshed for you.
Object Preview
Image, video, audio, PDF, or text preview, in place or in a dialog.
Actions and building blocks
Download
Download buttons with progress and cancel.
Delete
Delete buttons with one confirm dialog.
Attachment
File cards, progress rings, and type glyphs for your own parts.
How the components work
You create the hook; the component renders it. The upload, download, and delete components are families: a root takes one hook return, and the parts inside it read that hook.
"use client";
import { useUpload } from "@dimah-s3/react";
import {
Upload,
UploadStatus,
UploadToasts,
UploadTrigger,
} from "@dimah-s3/ui";
export function AvatarUploader() {
const upload = useUpload({ route: "avatar" }); // you own the hook
return (
<>
<Upload upload={upload}>
<UploadTrigger /> {/* opens the file picker */}
<UploadStatus /> {/* shows progress and errors */}
</Upload>
<UploadToasts upload={upload} /> {/* toasts for this hook */}
</>
);
}- Your hook, your rules. Route, limits, and callbacks live in the hook options. Components never call a hook themselves.
- Roots render no element. Place the parts anywhere inside the root, in your own layout. Several parts can share one hook.
- Toasts are opt-in. Parts never toast. Mount
UploadToasts,DownloadToasts, orDeleteToastsonce per hook, and one<Toaster />in your layout. - Parts are elements. Each part forwards the props of the element it
renders: triggers take every
Buttonprop, lists takeulprops, and so on.
| Family | Root | Hook | Parts |
|---|---|---|---|
| Upload | Upload | useUpload | UploadTrigger, UploadDropzone, UploadStatus, UploadFileList |
| Download | Download | useDownload, useFetchDownload | DownloadTrigger, DownloadProgress |
| Delete | Delete | useDelete | DeleteTrigger, DeleteConfirmDialog |
UploadField, AvatarUpload, ObjectCard, and ObjectList build on these
families, so the same hooks drive them.
npm package or shadcn registry
| npm package | shadcn registry | |
|---|---|---|
| You get | @dimah-s3/ui in node_modules | The component source in components/dimah-s3/ |
| Updates | Bump the package version | Run shadcn add again and merge |
| Primitives | Bundled, so any shadcn style works | Your own button, tooltip, … in a Base UI style |
| Customize | Props, className, theme tokens | Edit the code |
Start with the npm package. Switch an item to the registry when you need to change its markup. See Installation.
Built in
- Accessible. Built on Base UI primitives, with keyboard support, focus management, and live regions that announce progress and results.
- Translatable. Every string goes through
@fuma-translate/react, and layouts work right to left. See Internationalization. - Themeable. Colors follow your shadcn variables, and
--dimah-s3-*tokens override them for the components alone. See Theming. - Headless underneath. Need a different design? Build on the same hooks. See Custom UI.