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-merge

Then copy 2 files into your project:

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

Props

PropTypeDefaultDescription
positionnumber50Resting position of the tear.
handleWidthnumber2Thickness of the divider line.
rubberBandnumber0.35Give when dragged past an edge, hard stop → loose.
anglenumber0Lean of the tear off vertical.
snapBackbooleanfalseReturn to the resting position on release.
glownumber0.4Bloom along the divider.
accentColorstring (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

Appears In