UploadTile
UploadTile is an animated upload tile component for React Native and React, from the dissolve library. Attachment that assembles from grains, fills a progress ring, rejected files leave as dust.
An attachment tile for chat composers. The upload progress is the tile itself: from 0 to 1, its grains land one by one, a front running left to right, and at 1 the tile is whole. Only then the remove cross fades in. No ring, no badge. A file over maxSize, or an upload that rejects, completes, shakes three times, turns red and leaves as dust while the row closes up. Tap the tile during the upload to abort: the grains that have landed snap away from your finger. No picker dependency, you pass the files.
Install
React Native
Install the engine once per app and wrap the root layout in <DissolveProvider> (see Installation), then copy the component into components/dissolve:
npx expo install dissolve-ui @shopify/react-native-skia react-native-reanimated react-native-worklets react-native-gesture-handler expo-hapticsnpx dissolve-ui add upload-tile --nativenpx shadcn@latest add https://dissolve.rselmi.com/r/native/upload-tile.jsonReact
Needs React 19 and react-dom, nothing else: no engine, no provider, no Tailwind. Works in the Next.js App Router.
npx dissolve-ui add upload-tile --webnpx shadcn@latest add https://dissolve.rselmi.com/r/upload-tile.jsonUsage
import { UploadTray } from '@/components/dissolve/upload-tile';
<UploadTray
files={files}
upload={(file, onProgress, signal) => api.upload(file, { onProgress, signal })}
maxSize={25 * 1024 * 1024}
onAdd={pickFiles}
onRemove={(file) => setFiles((all) => all.filter((f) => f.id !== file.id))}
/>import { UploadTray } from '@/components/dissolve/upload-tile';
<UploadTray
files={files}
upload={(file, onProgress, signal) => api.upload(file, { onProgress, signal })}
maxSize={25 * 1024 * 1024}
onAdd={pickFiles}
onRemove={(file) => setFiles((all) => all.filter((f) => f.id !== file.id))}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
file | { id?, name, size, uri?, source? } | required | The file. An image uri or source shows as a thumbnail, anything else as a file icon, name and size. |
upload | (file, onProgress, signal) => Promise<void> | required | Your upload. Report progress 0 to 1: it drives how many grains have landed. Stop when the signal aborts (a tap on the tile aborts it), reject to show the error state. |
maxSize | number | Bytes. A bigger file is rejected without starting the upload. | |
size | number | 72 | Tile side. 6 pt of room are kept around it for the cross and the grains. |
spacing | number | 0 | Space after the tile in a row. It closes up with the tile. |
onDone | (file) => void | Called once the upload resolved and the tile is whole, as the cross appears. | |
onRemove | (file, reason: 'rejected' | 'cancelled' | 'removed') => void | Called once the tile has gone and its space has closed: drop the file here. | |
haptics | boolean | true | Success when whole, error on reject, light impact on cancel and remove. |
className | string | Outer wrapper classes (margins). | |
tileClassName | string | Tile classes (background, radius). |
Source
- React Native: registry/upload-tile.tsx
- React: registry/web/upload-tile.tsx and registry/web/upload-tile.core.ts
Previous: SweepTransition · Next: TaskCheck · All components
dissolve is MIT licensed. Source on GitHub, package on npm. This page as markdown. For AI agents: llms.txt.