For Tailwind CSS v3 docs, click here.

放大镜

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

通过 CLI 安装

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

手动安装

在同一个文件中,复制并粘贴以下代码:

Lens.vue
Rays.vue
Beams.vue

示例

Lens are static in center

API

Prop 名称类型默认值描述
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.

功能特性

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

感谢