Drag and Drop Flow
framecn/drag-and-drop-flowFreeComponent
Simulated file drag into a dropzone followed by upload progress.
Install it
npx shadcn@latest add https://framecn.dev/r/drag-and-drop-flow.jsonSource
1"use client";23import { Timegroup } from "@editframe/react";4import type { CSSProperties } from "react";56const FileIcon = ({ color }: { color: string }) => (7 <svg width="44" height="56" viewBox="0 0 44 56" fill="none">8 <path9 d="M6 4a4 4 0 014-4h18l12 12v40a4 4 0 01-4 4H10a4 4 0 01-4-4V4z"10 fill="white"11 stroke={color}12 strokeWidth="2"13 />14 <path15 d="M28 0v8a4 4 0 004 4h8"16 stroke={color}17 strokeWidth="2"18 fill="none"19 />20 <rect21 x="12"22 y="22"23 width="20"24 height="2"25 rx="1"26 fill={color}27 opacity="0.5"28 />29 <rect30 x="12"31 y="28"32 width="16"33 height="2"34 rx="1"35 fill={color}36 opacity="0.5"37 />38 <rect39 x="12"40 y="34"41 width="18"42 height="2"43 rx="1"44 fill={color}45 opacity="0.5"46 />47 </svg>48);4950export interface DragAndDropFlowProps {51 accent?: string;52 dropzoneLabel?: string;53 fileName?: string;54 background?: string;55 speed?: number;56 fps?: number;57 durationInFrames?: number;58 width?: number;59 height?: number;60 className?: string;61}6263export const DragAndDropFlow = ({64 accent = "#0ea5e9",65 dropzoneLabel = "Drop file to upload",66 fileName = "design.fig",67 background = "#fafafa",68 speed = 1,69 fps = 30,70 durationInFrames = 150,71 width = 1280,72 height = 720,73 className,74}: DragAndDropFlowProps) => {75 const safeSpeed = Math.max(0.01, speed);76 const durationMs = (durationInFrames / fps) * 1000;77 const frameMs = 1000 / fps;7879 const dragEndMs = (durationInFrames * 0.45 * frameMs) / safeSpeed;80 const highlightEndMs = (durationInFrames * 0.55 * frameMs) / safeSpeed;81 const progressEndMs = (durationInFrames * frameMs) / safeSpeed;8283 const containerStyle: CSSProperties = {84 alignItems: "center",85 background,86 display: "flex",87 fontFamily:88 "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",89 height,90 justifyContent: "center",91 overflow: "hidden",92 position: "relative",93 width,94 };9596 const dropzoneWidth = 420;97 const dropzoneHeight = 260;9899 return (100 <Timegroup101 className={className}102 duration={`${durationMs}ms`}103 mode="fixed"104 style={containerStyle}105 >106 <>107 <style>{`108 @keyframes framecn-drag-file {109 from { transform: translate(-220px, -120px); opacity: 0; }110 to { transform: translate(0, 0); opacity: 1; }111 }112// … truncated
What it pulls in
npm packages
Files it writes
More from framecn
All 101 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| AI Generate Overlayai-generate-overlay | framecn | Components | Free | 1 dep | |
| AI Generation Canvasai-generation-canvas | framecn | Components | Free | 1 dep | |
| Animated Bar Chartanimated-bar-chart | framecn | Components | Free | 1 dep | |
| Animated Line Chartanimated-line-chart | framecn | Components | Free | 1 dep | |
| Backdropbackdrop | framecn | Components | Free | 1 dep | |
| Blur Out Upblur-out-up | framecn | Components | Free | 1 dep | |
| Blur Revealblur-reveal | framecn | Components | Free | 1 dep | |
| Bounding Box Selectorbounding-box-selector | framecn | Components | Free | 1 dep |
