INTERACTION_097CSS + JS
Cursor Reactive Card
The card content shifts subtly with pointer position.
Cards / LightView
A card grows in place to reveal its detail without a page change. Collapsed with the detail at 0 height before the trigger; animating grid rows open and fading the detail in 80ms behind it once clicking the card header.
/* Expandable Card — A card grows in place to reveal its detail without a page change. */
.expandable-card {
--dur: 420ms;
--ease: cubic-bezier(0.22, 1, 0.36, 1);
--stagger: 60ms;
will-change: transform, opacity;
}
.expandable-card > * {
opacity: 0;
transform: translateY(14px);
animation: expandable-card-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* collapsed with the detail at 0 height -> animating grid rows open and fading the detail in 80ms behind it */
@keyframes expandable-card-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.expandable-card > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Expandable Card — trigger: clicking the card header */
export function ExpandableCard({ children }: { children: React.ReactNode }) {
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
const el = ref.current;
if (!el) return;
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
el.dataset["state"] = "in";
return;
}
const io = new IntersectionObserver(
([entry]) => {
if (entry?.isIntersecting) {
el.dataset["state"] = "in";
io.unobserve(el);
}
},
{ threshold: 0.2 },
);
io.observe(el);
return () => io.disconnect();
}, []);
return (
<div ref={ref} className="expandable-card" data-state="out">
{children}
</div>
);
}The card content shifts subtly with pointer position.
Two states swap inside the same card frame.
Move the cursor across this surface.
A soft radial light follows the cursor across the surface.
Perspective tilt that responds to pointer position.