File Upload
- Source
- Aceternity UI ↗
- Author
- Aceternity UI
- Licence
- Aceternity UI licence (free component)
Loading…
A drop zone that lifts its icon on hover and animates in the files you choose.
Code
"use client";
import React, { useState } from "react";
import { FileUpload } from "@/lab/aceternity/ui/file-upload";
import { Fit } from "./_fit";
export default function FileUploadDemo() {
// Files stay in the browser; nothing is uploaded anywhere.
const [, setFiles] = useState<File[]>([]);
const handleFileUpload = (files: File[]) => {
setFiles(files);
};
return (
<Fit width={760} height={460} max={1.3}>
<div className="flex h-full w-full items-center justify-center">
<div className="w-full max-w-4xl mx-auto min-h-96 border border-dashed bg-white dark:bg-black border-neutral-200 dark:border-neutral-800 rounded-lg">
<FileUpload onChange={handleFileUpload} />
</div>
</div>
</Fit>
);
}
Prompt
Build "File Upload", a input animation. What it does: A drop zone that lifts its icon on hover and animates in the files you choose. Write it as a single self-contained React component in TypeScript that fills its parent (w-full h-full), styled with Tailwind CSS, using @tabler/icons-react, motion, react-dropzone. Technique: the Motion library. It sits on a light background, in a 16:10 frame. Respect prefers-reduced-motion with a still state, pause work when the element is off screen, and keep it accessible. Original: https://ui.aceternity.com/components/file-upload (Aceternity UI, Aceternity UI licence (free component)).