INTERACTION_090CSS
Button Loading Transition
The label collapses into a compact progress indicator.
Buttons / LightView
A light segment travels around the border on hover. A static 1px border at low contrast before the trigger; rotating a conic gradient behind a masked border once hover, or a slow loop for the single primary CTA.
/* Animated Border Button — A light segment travels around the border on hover. */
.animated-border-button {
--dur: 2.6s;
--ease: linear;
--stagger: 60ms;
will-change: transform, opacity;
}
.animated-border-button > * {
opacity: 0;
transform: translateY(14px);
animation: animated-border-button-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* a static 1px border at low contrast -> rotating a conic gradient behind a masked border */
@keyframes animated-border-button-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.animated-border-button > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Animated Border Button — trigger: hover, or a slow loop for the single primary CTA */
export function AnimatedBorderButton({ 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="animated-border-button" data-state="out">
{children}
</div>
);
}The label collapses into a compact progress indicator.
A rounded fill rises from the bottom edge and floods the button.
A soft glow tracks the pointer inside the button surface.