A interactive component that enables zooming into images, videos and other elements.

Installation

pnpm dlx shadcn@latest add https://sase-ui.vercel.app/r/lens.json

Examples

Static Lens

Lens with a Default Position

Usage

import { Lens } from "@/components/ui/lens"
<Lens>
  <img src="/images/lens-demo.jpg" alt="Lens Demo" />
</Lens>

Props

PropertyTypeDefaultDescription
childrenReact.ReactNode-The content that will be magnified by the lens
zoomFactornumber1.3The magnification factor of the lens
lensSizenumber170The size of the lens in pixels (works as a diameter)
positionPosition-The current position of the lens
defaultPositionPosition-The initial position of the lens
isStaticbooleanfalseDetermines if the lens will remain in a fixed position
durationnumber0.1Duration of the animation when the lens moves (in seconds)
lensColorstring-The color of the lens (CSS color value)
ariaLabelstring-Accessibility label for the lens component