#3170
Feature: Add Upload component
It would be useful to have a reusable Upload component for handling file and folder uploads in desktop applications.
The component could support both traditional file selection and drag-and-drop interactions, providing a consistent way to handle file imports across applications.
Proposed features
- Click to open a native file picker
- Drag and drop files
- Support multiple files
- Optional folder selection
- Configurable accepted file types
- Disabled state
- Drag-over state
- Callback when files are selected or dropped
A basic usage could look like:
Upload::new()
.accept(["png", "jpg", "zip"])
.multiple(true)
.on_change(...)
.child(...)Or provide a default dropzone-style UI:
┌──────────────────────────────────┐
│ │
│ Drop files here │
│ or click to browse │
│ │
└──────────────────────────────────┘Use cases
This would be useful for common desktop application scenarios such as:
- Importing files or folders
- Importing models or assets
- Adding images
- Importing configuration files
- Drag-and-drop workflows
Implementation
The component could build on existing file picker and drag-and-drop capabilities where possible, while leaving the exact API and implementation details to gpui-kit.
The goal is to provide a reusable abstraction for file import interactions rather than requiring each application to implement the same behavior independently.
Thanks for the suggestion. This is a useful direction to explore, but GPUI already provides solid drag-and-drop support. I'm still weighing whether an Upload/DropZone abstraction adds enough value to belong in GPUI Kit, and I don't have a design I'm happy with yet. So I'm not committing to a component for now. If someone has a clean approach that builds on GPUI's existing capabilities and works well across these use cases, I'd be happy to take a look.