dimah-s3v0.4.1

Upload Button

A shadcn-styled button that opens the file picker for single- or multi-file uploads.

Preview

Install

npm i @dimah-s3/ui shadcn
app/globals.css
@import "shadcn/tailwind.css";
@import "@dimah-s3/ui/styles.css";

/* + shadcn theme variables */

shadcn theme variables must be in globals.css.

Mount the toaster once in your root layout:

app/layout.tsx
import { Toaster } from "@dimah-s3/ui";

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Toaster />
      </body>
    </html>
  );
}

Already using shadcn toast for your own messages? Mount both — rename one import (Toaster as DimahToaster). They are independent; your code keeps import { toast } from "@/components/ui/toast" and toast.add({ … }).

Props

Prop

Type

accept and maxFileSize are enforced client-side only. Always enforce the same limits in upload.presignGuard on the server.

Button appearance

UploadButton, DownloadButton, ProgressDownloadButton, and DeleteButton share optional shadcn button props:

PropDescription
variantshadcn button variant (defaults vary per component)
sizeshadcn button size (default if omitted)
buttonClassNameExtra classes on the trigger button
<UploadButton variant="secondary" size="sm" objectKey="uploads/file" />
<DownloadButton variant="ghost" objectKey="uploads/report.pdf" />
<DeleteButton variant="outline" objectKey="uploads/report.pdf" />

Headless alternative

Use useUploadControls when you need full control over the UI.

On this page