Components

Polaroid

An instant photograph: a white frame with the thick foot, a recessed square window and a caption in script. Put a real image in the window, or let it draw a little scene in marker and felt tip. Tape it, pin it, clip it, pile it up.

Install

terminal
npx shadcn@latest add @wobko/polaroid

First time here? Add the registry to components.json first. How to install

Examples

A polaroid

The frame, the recessed window, the caption in the foot. Here the window holds a drawn scene; a real photograph goes in the same place.

Four scenes, four ways to hold it up

Hills, sea, a house and a night sky, drawn in marker and felt tip. Taped, pinned, clipped and washi-taped; the sea has a date stamp.

Developing

`develop` starts the picture milky and clears it. Change the key and it happens again; with reduced motion the picture is just there.

A photo wall

A real composition: photographs at different tilts, overlapping a little, with a sticker stuck on. The window takes anything: here every picture is a drawn scene, in an app it would be an `img`.

API reference

Polaroid

A `figure` and a Paper (`photo` stock, no printed rules): 16 rem wide, padded 14 px on the sides and top with a taller foot. Photographs are turned more than paper, up to 1.5 degrees. It takes every Paper prop except `stock`, `rules` and `as`.

PropTypeDefaultDescription
as"figure" | "div" | "article""figure"The element; with `figure` the caption names the picture.

PolaroidImage

The photo window: square, recessed with an inner shadow, clipping its content. An `img` inside fills it (`object-cover`).

PropTypeDefaultDescription
scene"hills" | "sea" | "house" | "night"-Draw a scene in the window in marker and felt tip (14 KB or so each in the lo tier; use it for placeholders and empty states, not for a hundred thumbnails).
datestring-A retro camera's date stamp in the corner (orange, glowing).
developbooleanfalseThe picture is milky when it appears and clears over half a second. Once per mount; instant with reduced motion.
labelstring-Names a drawn scene (`role="img"`). Without it the scene is decoration.
seedstring | number-Pins the hand of the drawing.

Accessibility

  • Give a real photograph its `alt` text as usual; the figure and figcaption name it for assistive technology. A drawn scene is decoration unless you pass `label`.
  • The frame, window shadow, date stamp, veil, tape and fasteners are aria-hidden and pointer-events-none. The `date` stamp is decoration: if the date matters, say it in the caption or the alt text. Caption ink is 14:1 on the frame.
  • The developing veil does not run with reduced motion or in calm density's flattened tilt; the picture is simply there.

Source

The files the CLI copies into your project.

Loading the source