# UI Setup (https://v1.s3.dimah.dev/docs/react/ui)

[`@dimah-s3/ui`](https://www.npmjs.com/package/@dimah-s3/ui) provides accessible, theme-ready UI controls built on top of [shadcn](https://ui.shadcn.com) design tokens and `@dimah-s3/react` hooks.

## 1. Installation [#1-installation]

<Tabs items={["npm package", "shadcn registry"]}>

<Tab value="npm package">

```npm
npm i @dimah-s3/ui shadcn
```

</Tab>

<Tab value="shadcn registry">

```json title="components.json"
{
  "registries": {
    "@dimah-s3": "https://v1.s3.dimah.dev/r/{name}.json" // [!code ++]
  }
}
```

```npm
npx shadcn@latest add @dimah-s3/upload-button
```

</Tab>

</Tabs>

## 2. Import CSS stylesheet [#2-import-css-stylesheet]

Import the UI stylesheet in your global CSS to enable animations and design tokens:

```css title="app/globals.css"
@import "shadcn/tailwind.css";
@import "@dimah-s3/ui/styles.css"; /* [!code ++] */

/* shadcn theme variables (`--primary`, `--muted`, …) */
```

## 3. Mount Toaster [#3-mount-toaster]

Mount `<Toaster />` next to `<S3Provider>` in your root layout:

```tsx title="app/layout.tsx"
import { Toaster } from "@dimah-s3/ui"; // [!code ++]
import { S3Provider } from "@/lib/s3-client";

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>
        <S3Provider>{children}</S3Provider>
        {/* [!code ++] */}
        <Toaster />
      </body>
    </html>
  );
}
```

---

## Explore UI components [#explore-ui-components]

<Cards>
  <Card
    title="Attachment"
    href="/docs/react/ui/components/attachment"
    description="Reusable file and transfer status rows with previews, progress, and errors."
  />
  <Card
    title="Upload Button"
    href="/docs/react/ui/components/upload-button"
    description="Trigger native file picker with inline progress rows."
  />
  <Card
    title="Upload Dropzone"
    href="/docs/react/ui/components/upload-dropzone"
    description="Drag-and-drop surface for single and multi-file queue."
  />
  <Card
    title="Download Button"
    href="/docs/react/ui/components/download-button"
    description="One-click presigned download trigger."
  />
  <Card
    title="Progress Download Button"
    href="/docs/react/ui/components/progress-download-button"
    description="Live stream progress indicator with cancellation."
  />
  <Card
    title="Delete Button"
    href="/docs/react/ui/components/delete-button"
    description="Confirmation dialog and delete executor."
  />
  <Card
    title="Object List"
    href="/docs/react/ui/components/object-list"
    description="Folder and file list rendered from useObjectList or your own rows."
  />
  <Card
    title="Theming"
    href="/docs/react/ui/customization/theming"
    description="Customize colors with Tailwind and shadcn variables."
  />
</Cards>

## Frequently asked questions [#frequently-asked-questions]

<Accordions>

<Accordion title="Can I use shadcn components without installing the @dimah-s3/ui package?">

Yes. Use the shadcn registry command (`npx shadcn@latest add @dimah-s3/upload-button`) to copy component source directly into your codebase.

</Accordion>

</Accordions>
