Polaroid Develop, animated React component
- Pro
- Cards
- Spring
An instant photo you develop by dragging and shaking it: the faster it moves, the quicker the grey haze clears and the colour comes through. It swings with the drag velocity, develops slowly on its own, and writes a handwritten caption once it is done.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| src | string | — | Photo to develop. Without it the drawn scenes are shown. |
| alt | string | "" | Alt text for src. |
| caption | string | — | Handwritten caption for src once developed. Drawn scenes carry their own. |
| scenes | PolaroidScene[] | DEFAULT_POLAROID_SCENES | Drawn scenes cycled by New photo, each { sky, sea, sun, land, caption }. |
| onDeveloped | (caption: string) => void | — | Called when the photo finishes developing, with its caption (or alt). |
| autoplay | boolean | false | Shakes the photo by itself and swaps to a new one until someone touches it. |
| sensitivity | number | 1 | How quickly a shake clears the haze. Higher develops with gentler shakes. Clamped to 0.3 to 4. |
| swing | number | 1 | How far the photo tilts as you move it. 0 keeps it level. Clamped to 0 to 2. |
| elasticity | number | 0.5 | How far the photo follows the pointer when you drag it past its limit. Clamped to 0.1 to 1. |
| selfDevelop | boolean | true | Lets the photo develop slowly by itself, the way a real one does. Turn it off and only shaking develops it. |
| className | string | — | Extra classes for the root. |
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
Polaroid Develop 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 Polaroid Develop works
An instant photo you develop by shaking. Grab it and shake: the faster you move it, the quicker the grey haze clears and the colour comes through. It swings on its own weight as you drag, and once it's developed a caption writes itself along the bottom.
The source, the install command and the build prompt come with Pro.
Polaroid Develop questions
How do I install Polaroid Develop?
Run `npx shadcn@latest add @nexus-labs/polaroid-develop`. It installs framer-motion. Polaroid Develop is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).
How do I develop my own photo?
Pass `src` and `alt`. Add `caption` to have it written by hand once developed; without it no caption appears. `onDeveloped` is called with the caption, or `alt` if there is none. Without `src`, drawn scenes are shown.
How do I change the built-in scenes?
Pass `scenes` as objects of `{ sky, sea, sun, land, caption }`, where `sky` is a pair of gradient colours. The New photo button steps to the next scene and restarts the developing.
How does shaking develop the photo, and can I use the keyboard?
The faster you drag, the faster the haze clears, and it also develops slowly on its own. Focus the photo and press Enter or Space to shake it. Under reduced motion, that key advances the development in steps instead.

