Drop a file anywhere on the chat
Wrap a surface in the zone and a file dragged anywhere over it lands, so nobody has to aim for the composer. While files hover, an overlay covers the surface and says what letting go will do. Dropping is a pointer path, so pair it with an attach button for the keyboard.
Try it
Drag one or more files over the panel. Its edge lights up and the surface frosts over, and the files appear as tiles when you let go. They are read in your browser and go nowhere.
What it leaves alone
The zone only reacts to a drag that carries files. Dragging selected text or a link across it does nothing, and it keeps a file drop to itself so a drop target around it never handles the same files twice.
Props
Read from the same JSDoc that ships in the package's types. A required prop is marked with an asterisk.
| Prop | Type | Default | Description |
|---|---|---|---|
onFilesSelected | ((files: File[]) => void) | Fires with the files dropped anywhere on the zone. | |
disabled | boolean | false | Stops the zone reacting to drags; its children behave as if it were not there. |
icon | string | ReactNode | 'upload_file' | Icon above the overlay's headline: a Material Symbol name, or any
custom element. Pass `null` for none. |
label | string | 'Drop files to attach' | Headline of the overlay shown while files are dragged over the zone. |
hint | string | Second line of the overlay: what may be dropped, e.g. accepted types and limits. | |
className | string | '' | Additional CSS classes |
children | ReactNode | The surface that accepts drops: a chat panel, a thread and its composer. |
Keys
Nothing here takes focus, so there are no keys. A test holds that.
// From the npm package
import { AttachmentDropZone } from 'rift-ds/components/AttachmentDropZone/AttachmentDropZone';
// Or as source you own, via the shadcn CLI
npx shadcn@latest add https://rift-ds.com/r/attachment-drop-zone.json1.0 kB gzipped, with everything it imports. Peer dependencies are not counted.
For agents: the props, their allowed values and defaults, and the tested keys, as markdown or as a JSON schema.