UI / Decor
Vinyl Figure
A little vinyl figure from the 3D room on a turntable: classic or gold, standing or sitting, that spins when it is pressed.
Variant
Pose
Holding
Drag to turn it. Press it and it spins.
Installation
npx shadcn@latest add https://jiaweing.com/r/vinyl-figure.jsonWith the @jiaweing namespace set up, use @jiaweing/vinyl-figure in place of the URL.
Usage
tsx
import { VinylFigure } from "@/components/room/vinyl-figure";tsx
<div className="h-64 w-48">
<VinylFigure variant="gold" />
</div>- Press it and it spins.
- Drag sideways to turn it. Up and down drags still scroll the page.
- three.js is only fetched in the browser, once it is on the page. Nothing is drawn while it is scrolled out of sight, and the WebGL context is let go on unmount.
- For visitors who ask for reduced motion, it holds still and a press jumps straight to where it ends.
Props
VinylFigure
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "classic" | "gold" | "classic" | classic wears a black tee. gold stands on a plinth. |
| pose | "stand" | "sit" | "perch" | "stand" | Standing, sitting with its legs out, or perched upright on an edge. |
| holding | "none" | "cup" | "laptop" | "wave" | "light" | "pad" | "none", "wave" for gold | What it has in its hands. |
| spin | number | 0.35 | Turns a second on its own. 0 holds it still. |
| label | string | - | What screen readers say for it. |
| className | string | - | Classes on the stage. It fills its parent, so give the parent a height. |
MIT licensed. Copy it, change it, ship it.