Micro-interactions

Unfold

A row of slats that open on approach while their neighbours give up the room on a spring.

Install

bun add motion clsx tailwind-merge

Then copy 2 files into your project:

  • components/registry/unfold/unfold.tsx
  • lib/utils.ts

Props

PropTypeDefaultDescription
panelsnumber5How many slats to render.
expandRationumber3.5How much wider the open slat is than a closed one.
stiffnessnumber260Spring stiffness — higher snaps open faster.
dampingnumber30Spring damping — lower overshoots and settles.
labelRevealbooleantrueTurn the vertical rail label horizontal on open.
useImagebooleanfalseFade each panel's cut-out artwork in behind its slat.
gapnumber8Space between slats.

What It Demonstrates

Accordion / Collapse
A section smoothly expands and collapses its height to show or hide content.
Layout animation
When an element's size or position changes, it animates to the new spot instead of snapping.
Spring
Motion driven by physics (tension, mass, damping) rather than a set duration.
Stiffness / Tension
How strongly the spring pulls toward its target. Higher feels snappier.
Damping
How quickly a spring settles. Lower damping means more bounce and oscillation.
Hover effect
Visual change when the cursor moves over an element.
Layout thrashing
Animating properties like width, height, top, or left that force the browser to recalculate layout every frame, causing jank.

Related Components

Appears In