A interactive component that enables zooming into images, videos and other elements.
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
- motion
Code
"use client"
import { Button } from "@/components/ui/button"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { Lens } from "@/registry/magicui/lens"
export default function LensDemo() {
return (
<Card className="relative max-w-md shadow-none">
<CardHeader>
<Lens
zoomFactor={2}
lensSize={150}
isStatic={false}
ariaLabel="Zoom Area"
>
<img
src="https://images.unsplash.com/photo-1736606355698-5efdb410fe93?q=80&w=2071&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
alt="image placeholder"
width={500}
height={500}
/>
</Lens>
</CardHeader>
<CardContent>
<CardTitle className="text-2xl">Your next camp</CardTitle>
<CardDescription>
See our latest and best camp destinations all across the five
continents of the globe.
</CardDescription>
</CardContent>
<CardFooter className="space-x-4">
<Button>Let's go</Button>
<Button variant="secondary">Another time</Button>
</CardFooter>
</Card>
)
}






























