npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rc-magnifier

v1.0.7

Published

A React image magnifier component

Downloads

790

Readme

rc-magnifier

NPM Version NPM Total Downloads License

A powerful and versatile image magnification library for React.

Demo

Demo GIF

Installation

Install via npm:

npm install rc-magnifier

Or via yarn:

yarn add rc-magnifier

Overview

rc-magnifier is a comprehensive React library for implementing various image magnification effects. It provides several specialized components to enhance user experience when viewing detailed images, ranging from standard lens magnification to advanced fullscreen manipulation.


Global Configuration (Common Props)

All magnifier components share a set of base properties defined in BaseMagnifierProps.

| Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | src | string | Required | The main thumbnail image source. | | largeSrc | string | undefined | High-resolution image source for the zoomed view. | | width | number \| string | '100%' | Width of the image container. | | height | number \| string | 'auto' | Height of the image container. | | zoomFactor| number | 2.5 | Initial magnification level. | | minZoom | number | 1 | Minimum allowed zoom level (via wheel). | | maxZoom | number | 10 | Maximum allowed zoom level (via wheel). | | alt | string | '' | Image alternative text for accessibility. | | className | string | undefined | Custom CSS class for the container. | | style | React.CSSProperties| undefined | Custom inline styles for the container. |


Core Components

1. Magnifier

The standard magnification component with a "lens" effect.

| Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | lensSize | number | 120 | Size (diameter/width) of the lens or fixed panel. | | lensShape | 'circle' \| 'square' | 'circle' | Shape of the lens when position="follow". | | position | 'follow' \| 'left' \| 'right' \| 'top' \| 'bottom' | 'follow' | Where the zoomed view appears. | | borderColor| string | '#fff' | Border color of the lens/panel. | | borderWidth| number | 3 | Border width of the lens/panel in pixels. |

Usage

import { Magnifier } from 'rc-magnifier';

<Magnifier 
  src="image-thumb.jpg" 
  lensSize={150} 
  position="follow" 
/>

2. PiPMagnifier (Picture-in-Picture)

A magnifier where the zoomed view is pinned to a corner.

| Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | pipSize | number | 200 | Size of the fixed preview window. | | pipPosition| 'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right' | 'bottom-right' | Corner position of the PiP window. | | borderColor| string | '#fff' | Border color of the PiP window. |

Usage

import { PiPMagnifier } from 'rc-magnifier';

<PiPMagnifier 
  src="image-thumb.jpg" 
  pipSize={250} 
  pipPosition="top-right" 
/>

3. SplitMagnifier

Splits the view into a navigator and a dedicated zoom panel.

| Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | splitRatio | number | 0.5 | The ratio (0 to 1) between the navigator and zoom panel. |

Usage

import { SplitMagnifier } from 'rc-magnifier';

<SplitMagnifier 
  src="image-thumb.jpg" 
  splitRatio={0.4} 
/>

4. GridMagnifier

Shows several magnification levels at once in a grid layout.

| Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | levels | number[] | [1.5, 2, 3, 4] | Array of zoom factors to display in the grid. | | position | 'top' \| 'bottom' \| 'left' \| 'right' | 'bottom' | Grid placement relative to the image. |

Usage

import { GridMagnifier } from 'rc-magnifier';

<GridMagnifier 
  src="image-thumb.jpg" 
  levels={[2, 4, 8]} 
  position="right" 
/>

5. FullscreenMagnifier

Opens a fullscreen overlay with image manipulation tools.

| Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | triggerText | string | '🔍 Zoom' | Text for the open button. | | allowZoom | boolean | true | Enables/disables the zoom toggle button. |

Usage

import { FullscreenMagnifier } from 'rc-magnifier';

<FullscreenMagnifier 
  src="image-thumb.jpg" 
  triggerText="Inspect Image" 
/>

License

MIT © Yusuf Yılmaz