Installation
Install @dimah-s3/ui from npm or the shadcn registry, add the stylesheet, and mount the Toaster.
You need React 19.2, Tailwind CSS v4, a project set up with
shadcn, and the
React client: the components render inside S3Provider.
Install the components
npm i @dimah-s3/ui @dimah-s3/core @dimah-s3/react @fuma-translate/react @base-ui/react class-variance-authority cn lucide-react shadcn tw-animate-cssKeep the @dimah-s3/* packages on the same version. The package bundles its
own primitives, so it works with any shadcn style.
Add the stylesheet
npm only. Import it after Tailwind, tw-animate-css, and shadcn/tailwind.css:
@import "tailwindcss";
@import "tw-animate-css";
@import "shadcn/tailwind.css";
@import "@dimah-s3/ui/styles.css";
/* shadcn theme variables (`--primary`, `--muted`, …) */The registry writes the same styles into your CSS when you add an item.
Mount the Toaster
Components report progress and results as toasts. Mount one <Toaster />
next to S3Provider:
import { Toaster } from "@dimah-s3/ui";
import { S3Provider } from "@/lib/s3-client";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>
<S3Provider>{children}</S3Provider>
<Toaster /> {}
</body>
</html>
);
}With the registry, import it from @/components/ui/toast.
limit (default 3) caps the toasts shown at once, and timeout (default
5000 ms, 0 to keep them open) sets how long a result stays. Show your own
toasts in the same stack with toast:
import { toast } from "@dimah-s3/ui";
toast.add({
type: "error",
title: "Could not save",
action: { label: "Retry", onClick: save },
});Render a component
"use client";
import { useUpload } from "@dimah-s3/react";
import { Upload, UploadDropzone, UploadToasts } from "@dimah-s3/ui";
export function Attachments() {
const upload = useUpload({ route: "attachments", maxFiles: 5, append: true });
return (
<>
<Upload upload={upload}>
<UploadDropzone />
</Upload>
<UploadToasts upload={upload} />
</>
);
}route is the name of a route on your server.