Lens

A lens component to zoom into images, videos, or practically anything.

Install using CLI

npm
pnpm
bun
yarn
npx shadcn-vue@latest add "https://inspira-ui.com/r/lens.json"

Install Manually

Copy and paste the following code in the same folder

Lens.vue
Rays.vue
Beams.vue

Examples

Lens are static in center

API

Prop NameTypeDefaultDescription
zoomFactornumber1.5The magnification factor for the lens.
lensSizenumber170The diameter of the lens in pixels.
position{ x: number, y: number }{ x: 200, y: 150 }The static position of the lens (when isStatic is true).
isStaticbooleanfalseIf true, the lens stays in a fixed position; if false, it follows the mouse.
hoveringboolean"false"External control for the hover state.

Features

  • Slot Support: Easily add any content inside the component using the default slot.

Credits