Component for layered-stack
Install
Add it to your project
Run this in a project set up for shadcn/ui. It writes the files and installs the npm packages.
First time: connect the Infinity UI registry
- Create a personal token on your Tokens page.
- Put it in
.env.localasINFINITYUI_TOKEN. - Add the registry to
components.json:
{
"registries": {
"@infinityui": {
"url": "https://infinityui.io/r/{name}.json",
"headers": {
"Authorization": "Bearer ${INFINITYUI_TOKEN}"
}
}
}
}Using Claude Code, Codex, Cursor, Lovable or v0? See CLI & MCP for a setup prompt.
npm packages it adds
- gsap
Code
import { LayeredStack } from "@/components/ui/layered-stack"
const images = [
{
src: "https://images.unsplash.com/photo-1600585154340-be6161a56a0c?w=900&h=1200&q=85&auto=format&fit=crop",
alt: "Modern house exterior at dusk with warm interior lights",
},
{
src: "https://images.unsplash.com/photo-1514906689926-25ba6dcb584b?w=900&h=1200&q=85&auto=format&fit=crop",
alt: "Portrait of a woman seen through rippled glass",
},
{
src: "https://images.unsplash.com/photo-1568557412756-7d219873dd11?w=900&h=1200&q=85&auto=format&fit=crop",
alt: "Blurred figures dancing in a red-lit room",
},
{
src: "https://images.unsplash.com/photo-1581892805885-73bdd91beff0?w=900&h=1200&q=85&auto=format&fit=crop",
alt: "Black-and-white motion-blurred figure covering their face",
},
{
src: "https://images.unsplash.com/photo-1482938289607-e9573fc25ebb?w=900&h=1200&q=85&auto=format&fit=crop",
alt: "Turquoise river winding through a misty canyon",
},
{
src: "https://images.unsplash.com/photo-1610846202780-b4d9837371ea?w=900&h=1200&q=85&auto=format&fit=crop",
alt: "Motion-blurred man walking against a green-gray backdrop",
},
{
src: "https://images.unsplash.com/photo-1527630941-4a229fd674ab?w=900&h=1200&q=85&auto=format&fit=crop",
alt: "Black-and-white photo of a man seated against a reflective wall",
},
{
src: "https://images.unsplash.com/photo-1603786420263-ad59136a7409?w=900&h=1200&q=85&auto=format&fit=crop",
alt: "Heavily motion-blurred portrait of a person in a striped shirt",
},
];
export const Demo = () => {
return (
<LayeredStack className="w-full max-w-[920px] grid grid-cols-4 gap-4 p-8">
{images.map((img, i) => (
<img key={i} src={img.src} alt={img.alt} className="object-cover w-full aspect-[250/320] shadow-xl" />
))}
</LayeredStack>
);
};
import * as __R from "react";
export default function __InfinityFrame() {
__R.useEffect(() => {
// Simulated cursor: a slow figure-eight, so pointer-driven effects draw something.
let t = 0;
const id = setInterval(() => {
t += 0.05;
const x = innerWidth * (0.5 + 0.32 * Math.sin(t));
const y = innerHeight * (0.5 + 0.22 * Math.sin(2 * t));
const el = document.elementFromPoint(x, y);
if (!el) return;
const init = { clientX: x, clientY: y, pageX: x, pageY: y, bubbles: true, cancelable: true, view: window };
el.dispatchEvent(new PointerEvent("pointermove", { ...init, pointerType: "mouse", isPrimary: true }));
el.dispatchEvent(new MouseEvent("mousemove", init));
}, 30);
return () => clearInterval(id);
}, []);
return (
<div style={{ position: "relative", width: "100vw", height: "100vh", display: "flex", alignItems: "center", justifyContent: "center", overflow: "hidden" }}>
<Demo />
</div>
);
}
































