Micro-interactions

Approach

A tile whose overlay enters from the exact edge your cursor crossed, and leaves the way you go.

Install

bun add clsx tailwind-merge

Then copy 2 files into your project:

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

Props

PropTypeDefaultDescription
overlayOpacitynumber0.92Opacity of the overlay panel.
durationnumber420Travel time of the overlay.
skewnumber4Shear while the overlay is off-position.
blurnumber0Blur on the overlay while it is moving.
offsetDistancenumber100How far off-tile the overlay starts.
overlayColorstring (hex)"#a855f7"Amethyst overlay panel.

What It Demonstrates

Direction-aware transition
Content slides one way going forward and the opposite way going back, so navigation has a sense of direction.
Enter / Exit
The animation an element plays when it's added to or removed from the screen.
Translate
Move an element along the X or Y axis.
Skew
Slant an element along the X or Y axis, shearing it out of its rectangular shape.
Hover effect
Visual change when the cursor moves over an element.
Spatial consistency
Animating so an element keeps its identity and position across states, so users never lose track of where things went.
Cubic-bezier
A custom easing curve you define for precise control.

Related Components

Appears In