Micro-interactions
Rift
A draggable tear between two overlaid scenes — push past an edge and it resists, then snaps back.
Install
bun add clsx tailwind-mergeThen copy 2 files into your project:
- components/registry/rift/rift.tsx
- lib/utils.ts
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| position | number | 50 | Resting position of the tear. |
| handleWidth | number | 2 | Thickness of the divider line. |
| rubberBand | number | 0.35 | Give when dragged past an edge, hard stop → loose. |
| angle | number | 0 | Lean of the tear off vertical. |
| snapBack | boolean | false | Return to the resting position on release. |
| glow | number | 0.4 | Bloom along the divider. |
| accentColor | string (hex) | "#a855f7" | Amethyst divider. |
What It Demonstrates
- Clip-path
- Clipping an element to a shape, used for reveals, masks, and before/after sliders.
- Before / after slider
- A draggable divider that wipes between two overlaid images to compare them.
- Drag
- Moving an element by grabbing it, often with momentum when released.
- Rubber-banding
- Resistance and snap-back when you drag past a boundary (the iOS overscroll feel).
- Continuity transition
- A change that keeps the user oriented by visually connecting before and after. For example, making the same rectangle bigger and smaller.
- Reveal
- Content is uncovered gradually, often by animating a clip-path or mask.
Related Components
Stagger Menu
A menu overlay that blooms open as a clip-path circle spring while items stagger in with blur and rotation, then collapses back to its pill.
Aperture
A camera iris. Blades pivot on a ring of pins and one shared angle drives the whole mechanism — wide open at 64% of the housing, past the centre and light-tight at zero, cutting the scalloped polygon a real iris makes on the way through.
Lens
A glass lens you drag across live content, bending it through an SVG displacement field with a real bevel and three-channel dispersion. It refracts a live duplicate of its own children rather than the page backdrop — which is the only version of this effect that works in Chrome, Safari and Firefox alike.
Pixel Transition
Reveal a second layer through a random pixelated dissolve on hover.
Morph Dialog
A dialog that morphs open from its trigger via shared-layout animation, with elements that travel between card and panel.
Hover List
A display-type list where a shared accent block springs between rows on hover while the text indents and inverts.