Hanging
Markup where the component goes, CSS in your stylesheet, script before </body>. In Vue, Svelte or Angular, call initCardHanging(el) on the mounted element instead.
Paste into Claude, ChatGPT or Cursor after filling in {{USER_STACK}}, {{USER_STYLING}} and {{USER_CONSTRAINTS}}. Neutral keeps the greys you see here; Match my project asks the model to map them onto your own colour tokens.
Install with shadcn
Needs a free account token. Get a token
npx shadcn@latest add @movin/card-hangingAbout this component
A shop hours card hung on a cord from a nail: brush past it and it swings, harder the faster you go, and settles on a damped pendulum; press it and the sign turns over on its cord from Open to Closed.
- Dependencies
- None
- Difficulty
- Intermediate
- Reduced motion
- Respected
- Theme
- Light and dark
- Follows page color-scheme
Triggers5
- Mouse tracking
- Click
- 3D
- Spring
- Card
Techniques4
- requestAnimationFrame
- Event position
- preserve-3d
- CSS variables
Accessibility
Keyboard and screen readers
The sign is one button whose label says what it shows and what pressing does (Shop is open, turn sign to closed); the face that is turned away is aria-hidden.
Reduced motion
The sign does not swing and turns over instantly.
Use it in anything you build, commercial and client work included. Licence
More cards
See allDorset · June, late afternoon
What do you see?
Pencil, then ink · 14 Nov
Salt & Iron
Wren Halloway
Hardback
312 pages