@input-kit/upload
v0.1.1
Published
React file upload primitives with drag-and-drop, previews, validation, and queues
Downloads
68
Maintainers
Readme
@input-kit/upload
React file upload primitives with drag-and-drop, preview support, validation, queues, and render-prop customization.
Installation
npm install @input-kit/uploadFeatures
- Drag-and-drop upload zone with active drag styling
- Queue management with concurrency limits
- File validation for count, size, and MIME types
- Image preview URLs out of the box
- Abort, retry, remove, and clear queue controls
- Render-prop API for custom upload surfaces
Usage
import { FileUpload } from '@input-kit/upload';
export function Example() {
return (
<FileUpload
url="/api/upload"
accept="image/*,.pdf"
maxFiles={5}
maxFileSize={5 * 1024 * 1024}
/>
);
}Custom Surface
import { FileUpload, UploadList } from '@input-kit/upload';
<FileUpload url="/api/upload" autoUpload={false}>
{({ files, removeFile, openFileDialog, isDragActive }) => (
<div>
<button onClick={openFileDialog} type="button">
{isDragActive ? 'Release to add files' : 'Browse files'}
</button>
<UploadList files={files} onRemove={removeFile} />
</div>
)}
</FileUpload>Notes
- Use
autoUpload={false}when you want a review step before uploading. UploadListandUploadProgresscan be composed outsideFileUploadfor custom workflows.- The render prop now receives both
isDragActiveandopenFileDialogfor richer custom UI.
License
MIT © Input Kit
