Skip to content
StackD
File drop, the StackD component

Inputs · €7

File drop

A dropzone where the Bot eats your files, with upload progress, retry and limits.

Pay once on Gumroad: the download, plus a licence key for the registry and the MCP server.

Details

Category
Inputs
Plan
Paid, €7 once
Code
React + Tailwind, TypeScript · 959 lines
Files
FileDrop.tsx
Needs
The Bot (installed with it)
Agents
MCP server and shadcn registry

About

A dropzone with the Bot (StackD Kit 01) in the middle. Drag files over the page and it looks up and opens its mouth; bring them over the zone and it opens wide. Let go and the file is pulled into its mouth, the Bot chews, and the files come out below as rows that upload with a rolling percentage and a bar. Images get a thumbnail, other files a coloured type badge.

Too big or the wrong type: the Bot shakes its head and the row says why. Keep trying the same thing and it starts answering back, and after a few tries it won't open its mouth at all (for 8 seconds). A failed upload can be retried; one in progress can be cancelled.

Drop, click (or Enter / Space) to browse, or paste with ⌘V. White and black versions. Works with screen readers. React + Tailwind, no other libraries. Respects reduced motion.

Install

Once: add the StackD registry to components.json, with the licence key from your receipt in STACKD_LICENSE_KEY (in .env.local):

"registries": {
  "@stackd": {
    "url": "https://www.stackd.codes/r/{name}.json",
    "headers": { "X-License-Key": "${STACKD_LICENSE_KEY}" }
  }
}

With the shadcn CLI:

npx shadcn@latest add @stackd/file-drop

Or let your agent add it through the StackD MCP server:

claude mcp add --transport http stackd https://www.stackd.codes/mcp

Prompt for your agent

Paste it into Claude Code, Cursor, Codex or VS Code once the MCP server is connected.

Add the StackD File drop component to this project. Use the StackD MCP server: call get_component with { "name": "file-drop" }, write the files at the paths it gives and install any npm packages it lists. Then use it where it fits, following its README for the props, and keep its own styles. It is a paid component: if the server says it needs a licence, tell me where to buy it.

Use

  1. Copy FileDrop.tsx and Bot.tsx into the same folder of your project (for example components/).

If you already have the Bot from an earlier StackD component, replace it with this one: it adds the mouth prop. Everything else works the same.

  1. Use it, with your own upload:
import { FileDrop } from './components/FileDrop'

<FileDrop
  accept="image/*,.pdf"
  maxSize={5 * 1024 * 1024}
  upload={async (file, { onProgress, signal }) => {
    // Any upload works: call onProgress with 0–1, throw to show "Upload failed"
    const body = new FormData()
    body.append('file', file)
    await fetch('/api/upload', { method: 'POST', body, signal })
    onProgress(1)
  }}
  onChange={(files) => setAttachments(files.filter((f) => f.status === 'done'))}
/>

With real progress (XMLHttpRequest reports it, fetch doesn't yet):

const upload = (file: File, { onProgress, signal }: { onProgress: (p: number) => void; signal: AbortSignal }) =>
  new Promise((resolve, reject) => {
    const xhr = new XMLHttpRequest()
    xhr.upload.onprogress = (e) => e.lengthComputable && onProgress(e.loaded / e.total)
    xhr.onload = () => (xhr.status < 300 ? resolve(xhr.response) : reject(new Error(String(xhr.status))))
    xhr.onerror = reject
    signal.addEventListener('abort', () => xhr.abort())
    xhr.open('POST', '/api/upload')
    xhr.send(file)
  })

Without upload it pretends to upload, so you can try it before there's a backend.

A tray of pretend files under the zone, for demos, onboarding or empty states:

<FileDrop
  samples={[
    { name: 'moodboard.png', type: 'image/png', size: 2.4 * 1024 * 1024, color: '#C9B8FF' },
    { name: 'brief.pdf', type: 'application/pdf', size: 860 * 1024 },
  ]}
/>

In Next.js the files already start with 'use client'. In other React setups that line does nothing.

Options

PropDefaultWhat it does
uploadpretend upload(file, { onProgress, signal }) => Promise. Throw or reject for "Upload failed"
acceptanythingLike the input's accept: "image/*,.pdf,.zip"
maxSize10 MBIn bytes
maxFiles6How many files the list holds
multipletruefalse: one file at a time, a new one replaces it
onChange(files) => void, every change to the list (see DropFile below)
theme'light''light' (white card) or 'dark' (black card)
botpill, tall eyes{ shape, eyes } for the Bot, from Kit 01
title'Drop files here'The line under the Bot
hintfrom accept and maxSizeThe small line under the title, e.g. "Images or PDF · up to 5 MB"
samplesPretend files on a tray: { name, type, size, color? }[]
compactfalseSmaller zone and Bot, no list: the newest upload shows inside the zone

Each file in onChange is a DropFile: { id, file, size, status, progress, error?, preview? }, with status one of 'uploading', 'done', 'error', 'rejected'.

The Bot's mouth

The Bot now has a mouth prop, from 0 (closed, not drawn) to 1 (wide open). It sits on the sphere below the eyes and turns with the head. You can use it anywhere:

<Bot mouth={0.6} />

Keyboard

Tab to the zone, Enter or Space to browse. ⌘V / Ctrl+V pastes files while the card has focus or the pointer. Each row's Retry and Remove / Cancel are buttons. Sample files: Enter adds them.

Colours from StackD

White #FFFFFF · Ink #141310 · Wine #901919 · Olive #6C8544 · Ochre #BE9344 · Lilac #C9B8FF

Licence

You can use it in personal and commercial projects. Don't resell or share the component on its own.

Made by StackD · stackd.codes