Components
Renders an area for uploading files with a native HTML file input, handling click and drag events with an onChange handler for the uploaded file data. Supports a separate Trigger element, custom children composition, inline rendering and a headless variant with render props exposing the drag-over state.
npx @21st-dev/cli add reshaped/reshaped-file-uploadLoading preview...
import { Icon, Reshaped, View } from "reshaped/bundle";
import FileUpload from "@/components/ui/reshaped-file-upload";
const MicIcon = () => (
<svg
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" />
<path d="M19 10v2a7 7 0 0 1-14 0v-2" />
<line x1="12" y1="19" x2="12" y2="23" />
<line x1="8" y1="23" x2="16" y2="23" />
</svg>
);
export default function Demo() {
return (
<Reshaped theme="slate">
<div style={{ maxWidth: 480, width: "100%", margin: "0 auto", padding: 24 }}>
<FileUpload name="file">
<View gap={2}>
<Icon svg={MicIcon} size={6} />
Drop files to attach
</View>
</FileUpload>
</div>
</Reshaped>
);
}
Loading preview...
Loading preview...
Loading preview...
Loading preview...