Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Backgrounds

  • DotPattern
  • GridPattern
  • StripedPattern
  • Spotlight
  • FadeMask
  • RetroGrid
  • Ripple
  • Meteors
  • Aurora
  • Particles
  • FlickeringGrid
  • WavyBackground
  • Silk
  • Iridescence
  • Threads
  • Orb
  • LiquidChrome
  • Balatro
  • Ballpit
  • Beams
  • ColorBends
  • DarkVeil
  • Dither
  • DotField
  • EvilEye
  • FaultyTerminal
  • Ferrofluid
  • FloatingLines
  • Galaxy
  • GradientBlinds
  • Grainient
  • GridDistortion
  • GridMotion
  • GridScan
  • Hyperspeed
  • LetterGlitch
  • Lightfall
  • Lightning
  • LightPillar
  • LightRays
  • LineWaves
  • LiquidEther
  • PixelBlast
  • PixelSnow
  • Plasma
  • PlasmaWave
  • Prism
  • PrismaticBurst
  • Radar
  • RippleGrid
  • ShapeGrid
  • SideRays
  • SoftAurora

Overlay Effects

  • BorderBeam
  • ShineBorder
  • GlareHover
  • Lens
  • AnimatedBeam
  • OrbitingCircles
  • ProgressiveBlur
  • CardSpotlight
  • Reveal
  • Antigravity
  • BlobCursor
  • ClickSpark
  • Crosshair
  • ElectricBorder
  • GhostCursor
  • GradualBlur
  • ImageTrail
  • LaserFlow
  • MagicRings
  • Magnet
  • MagnetLines
  • MetaBalls
  • MetallicPaint
  • OrbitImages
  • PixelTrail
  • PixelTransition
  • Ribbons
  • ShapeBlur
  • SplashCursor
  • StarBorder
  • StickerPeel
  • TargetCursor
  • Cubes
  • Tilt
  • BorderGlow
  • GlassIcons
  • GlassSurface
  • Lanyard
  • ModelViewer
  • FluidGlass

Lens

lens

Magnifies arbitrary content beneath a movable circular lens.

Usage

Basic usage

Package image, displays a circular magnifying glass at the cursor when hovering.

Forest
tsx
<Lens className="w-80 rounded-[var(--radius)] border border-border">
  <img src="/photo.jpg" alt="Forest" className="block aspect-[4/3] w-full object-cover" />
</Lens>

Magnification

zoom Controls the zoom ratio under the magnifying glass. The larger the magnification, the more prominent the details.

Forest
tsx
<Lens zoom={2.6} className="w-80 rounded-[var(--radius)] border border-border">
  <img src="/photo.jpg" alt="Forest" className="block aspect-[4/3] w-full object-cover" />
</Lens>

Lens size

size Set the diameter of the magnifying glass (px), and use zoom to adjust the appropriate observation window.

Forest
tsx
<Lens zoom={2} size={200} className="w-80 rounded-[var(--radius)] border border-border">
  <img src="/photo.jpg" alt="Forest" className="block aspect-[4/3] w-full object-cover" />
</Lens>

When to Use

Use it to magnify a local area of product imagery, maps, screenshots, or arbitrary children through a circular pointer-following lens. It has no runtime dependency beyond its mask-and-scale implementation. Use GlareHover for a diagonal reflection, or BorderBeam and ShineBorder for border lighting.

Import

ts
import { Lens } from "@hulianui/ui"

Props

NameTypeDefaultDescription
zoomnumber1.6Magnification
sizenumber140Lens diameter in pixels
classNamestring-Forwarding className

Slots

SlotTypeDescription
childrenReactNodeAmplified content (usually <img>)

Usage Guidelines

  • It needs to be triggered by pointer hover. There is no magnification effect in pure touch screen/keyboard scenarios. Do not use it as the only way to view details.
  • children must be visual content with a certain size that can be scaled (such as <img> of block), otherwise the lens magnification area will be empty.

Related

BorderBeam · ShineBorder · GlareHover · AnimatedBeam · OrbitingCircles · ProgressiveBlur

Playground

Forest
<Lens zoom={1.8}>
  <img src="/photo.jpg" />
</Lens>
PreviousGlareHoverDecorationNextAnimatedBeam

On this page

  • Usage
  • Documentation
    • When to Use
    • Import
    • Props
    • Slots
    • Usage Guidelines
    • Related
  • Playground