BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/prompt-kit/file-upload

File Upload

prompt-kit-agents-ui/file-upload
FreeComponent

A component for creating drag-and-drop file upload interfaces with support for single or multiple files, custom triggers, and visual feedback during file dragging operations.

Install it

npx shadcn@latest add https://raw.githubusercontent.com/agents-ui/agents-kit/main/public/c/file-upload.json

Source

file-upload.tsxraw.githubusercontent.com/agents-ui/agents-kit/main/public/c/file-upload.json
1"use client"
2
3import { cn } from "@/lib/utils"
4import {
5 Children,
6 cloneElement,
7 createContext,
8 useCallback,
9 useContext,
10 useEffect,
11 useRef,
12 useState,
13} from "react"
14import { createPortal } from "react-dom"
15
16type FileUploadContextValue = {
17 isDragging: boolean
18 inputRef: React.RefObject<HTMLInputElement | null>
19 multiple?: boolean
20 disabled?: boolean
21}
22
23const FileUploadContext = createContext<FileUploadContextValue | null>(null)
24
25export type FileUploadProps = {
26 onFilesAdded: (files: File[]) => void
27 children: React.ReactNode
28 multiple?: boolean
29 accept?: string
30 disabled?: boolean
31}
32
33function FileUpload({
34 onFilesAdded,
35 children,
36 multiple = true,
37 accept,
38 disabled = false,
39}: FileUploadProps) {
40 const inputRef = useRef<HTMLInputElement>(null)
41 const [isDragging, setIsDragging] = useState(false)
42 const dragCounter = useRef(0)
43
44 const handleFiles = useCallback(
45 (files: FileList) => {
46 const newFiles = Array.from(files)
47 if (multiple) {
48 onFilesAdded(newFiles)
49 } else {
50 onFilesAdded(newFiles.slice(0, 1))
51 }
52 },
53 [multiple, onFilesAdded]
54 )
55
56 useEffect(() => {
57 const handleDrag = (e: DragEvent) => {
58 e.preventDefault()
59 e.stopPropagation()
60 }
61
62 const handleDragIn = (e: DragEvent) => {
63 handleDrag(e)
64 dragCounter.current++
65 if (e.dataTransfer?.items.length) setIsDragging(true)
66 }
67
68 const handleDragOut = (e: DragEvent) => {
69 handleDrag(e)
70 dragCounter.current--
71 if (dragCounter.current === 0) setIsDragging(false)
72 }
73
74 const handleDrop = (e: DragEvent) => {
75 handleDrag(e)
76 setIsDragging(false)
77 dragCounter.current = 0
78 if (e.dataTransfer?.files.length) {
79 handleFiles(e.dataTransfer.files)
80 }
81 }
82
83 window.addEventListener("dragenter", handleDragIn)
84 window.addEventListener("dragleave", handleDragOut)
85 window.addEventListener("dragover", handleDrag)
86 window.addEventListener("drop", handleDrop)
87
88 return () => {
89 window.removeEventListener("dragenter", handleDragIn)
90 window.removeEventListener("dragleave", handleDragOut)
91 window.removeEventListener("dragover", handleDrag)
92 window.removeEventListener("drop", handleDrop)
93 }
94 }, [handleFiles, onFilesAdded, multiple])
95
96 const handleFileSelect = (e: React.ChangeEvent<HTMLInputElement>) => {
97 if (e.target.files?.length) {
98 handleFiles(e.target.files)
99 e.target.value = ""
100 }
101 }
102
103 return (
104// … truncated

Files it writes

  • components/prompt-kit/file-upload.tsx

Facts

Registry
prompt-kit
Type
registry:ui
Access
Free
Files written
1
Licence
NOASSERTION
In the index
at or before 2026-08-10
Last confirmed
3 days ago

Go to the source

agents-ui.github.io agents-ui/agents-kit on GitHub Raw registry item This item as JSON

More from prompt-kit

All 12 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Chat Containerchat-containerprompt-kitComponentsFree1 dep
Code Blockcode-blockprompt-kitComponentsFree1 dep
Jsx Previewjsx-previewprompt-kitComponentsFree1 dep
Loaderloaderprompt-kitComponentsFreeno deps
Markdownmarkdownprompt-kitComponentsFree4 deps · 2 files
Messagemessageprompt-kitComponentsFree5 deps · 3 files
Prompt Inputprompt-inputprompt-kitComponentsFreeno deps
Prompt Suggestionprompt-suggestionprompt-kitComponentsFree2 deps

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