BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/moumenlab/file-upload-staging

File Upload Staging Area

moumenlab/file-upload-staging
FreeComponent

Per-tile interruptible upload state machines with capped concurrency and a layout-glide grid reflow.

Live preview

live · rendered by the registry
Rendered by moumenlab on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://lab.moumen.dev/r/file-upload-staging.json

Source

registry/lab/file-upload-staging/file-upload-staging.tsxlab.moumen.dev/r/file-upload-staging.json · first 6 KB
1"use client";
2
3import { useEffect, useImperativeHandle, useRef, useState, type Ref } from "react";
4import { MotionConfig, motion } from "motion/react";
5
6// File upload staging area - a pipeline expressed through motion.
7//
8// Three hard problems, none of them the dropzone:
9//
10// · A reflowing GRID that never jump-cuts. Tiles are motion.li with `layout`:
11// removing a tile mid-grid makes every later tile glide up and across, and
12// entering tiles scale + unblur in. Exits stay subtler than enters - here,
13// instant.
14// · An interruptible state machine PER TILE: queued → uploading → done, or
15// → error frozen at the failure percent. Retry RESUMES from that percent
16// (the arc never lies by rewinding), removal works in any state, and a
17// freed slot immediately promotes the next queued tile - concurrency is
18// capped at 2 so the pipeline is visible instead of everything blasting
19// to 100% at once.
20// · Honest jittered progress. One shared ticker advances every uploading
21// tile by a random 0.6-4% with a 12% chance to stall a beat - variable
22// like a real network - but progress NEVER moves backwards and 100% is
23// the only way to complete. Failures are decided up front (a hidden
24// failAt percent), not rolled per frame.
25//
26// TWO MODES, one pipeline:
27//
28// · No `upload` prop → the built-in simulation (nothing leaves the page).
29// Works out of the box; `failRate` shapes the demo.
30// · An `upload` adapter → REAL uploads. The component keeps owning the queue,
31// concurrency, retry and removal; your adapter owns the network:
32//
33// <UploadStaging
34// upload={async ({ file, name }, { onProgress, signal }) => {
35// await api.upload(file!, { signal, onProgress }); // report 0-100
36// }}
37// />
38//
39// Resolve → done. Throw → error, frozen at the last reported percent.
40// Removing a tile mid-flight aborts via the AbortSignal. Retry re-invokes
41// the adapter; the arc still never rewinds (progress is forward-only, so a
42// restarted transfer catches up to the frozen percent before it moves).
43//
44// Real drag-and-drop and the file picker both work (the original File rides
45// along for the adapter); stage files programmatically through the ref handle:
46//
47// const staging = useRef<UploadStagingHandle>(null);
48// staging.current?.addFiles([{ name: "report.pdf", size: 842_000 }]);
49//
50// … truncated

What it pulls in

npm packages

  • motion

Other registry items

  • https://lab.moumen.dev/r/lab-theme.json

Files it writes

  • registry/lab/file-upload-staging/file-upload-staging.tsx

Facts

Registry
moumenlab
Type
registry:component
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-13
Last confirmed
yesterday

Go to the source

Docs on moumenlab lab.moumen.dev moumen-soliman/lab on GitHub Raw registry item This item as JSON

More from moumenlab

All 14 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Caret-Anchored Mention Popovercaret-mention-popovermoumenlabComponentsFree1 dep
Command Palette with Argument Chipscommand-palettemoumenlabComponentsFree1 dep
Drag-to-Reorder Listdrag-to-reorder-listmoumenlabComponentsFree1 dep
Hover-Expand Icon Striphover-expand-icon-stripmoumenlabComponentsFree1 dep
Inertial Wheel Listinertial-wheel-listmoumenlabComponentsFree1 dep
Morphing Checkout Flowmorphing-checkoutmoumenlabComponentsFree1 dep
OTP Segmented Inputotp-segmented-inputmoumenlabComponentsFree1 dep
Schedule Builderschedule-buildermoumenlabComponentsFree1 dep

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex