Pearl Drop, animated React component
A file dropzone with a pearl in it. Drop files on the panel, browse, or drag one of the sample files underneath, and each file gets its own row with a progress bar whose head flows with rainbow light. The pearl is a halftone glass sphere: an empty shell of fine dots while you hold a file over it, then it fills from the bottom with swaying rainbow liquid as the newest upload runs, with the percentage in the middle, and a tick of bright dots rises through it when the file is done. A file that is too big, of the wrong type or that fails scatters the pearl red and says why in its row, with a retry for failures. Every row can be removed and Clear all empties the list.
- Pro
- Inputs & Controls
- Spring
- Glow
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| upload | (file: File, onProgress: (p: number) => void) => Promise<void> | — | Send each file somewhere and call onProgress with 0 to 1 as it goes. Leave it out and uploads are simulated. |
| onFile | (file: File) => void | — | Called with every file that passes the checks. |
| onRemove | (name: string) => void | — | Called with the name of a file removed from the list. |
| accept | string | "" | The types let through, written like the accept attribute of a file input. |
| maxSizeMB | number | 20 | The biggest file allowed, in MB. |
| samples | PearlSample[] | three made-up files | The made-up files under the card that you can drag in to try it. An empty list hides the row. |
| hue | number | 0.5 | Where the pearl's colours start in the rainbow ramp, 0 to 1. |
| index | string | "12" | The number in the cell's corner. |
| caption | string | "Pearl Drop" | The name in the cell's corner. |
| bare | boolean | false | Drop the dark card and keep the layout. |
| autoplay | boolean | false | Drags the sample files in by itself until the visitor touches it. Never runs under reduced motion. |
| className | string | "" | Extra classes for the outer element. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry with your API key
Pearl Drop is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
How Pearl Drop works
A dropzone with a pearl in it. Drop files on the panel (or browse, or drag one of the sample files underneath) and each one gets a row with its own progress bar with a flowing rainbow head. At rest the panel shows only its icon. The pearl is a halftone glass sphere: when that file is done the pearl dims and a tick of bright dots comes up through it. Held over, the panel lifts, a halftone of dots gathers under the pointer and a rainbow rim turns round it.
The source, the install command and the build prompt come with Pro.