1.4.0 • Published 2 months ago

dha-zoomable-image v1.4.0

Weekly downloads
-
License
-
Repository
-
Last release
2 months ago

dha-zoomable-image

A React component that allows you to zoom in on an image, as well as pan the image for a better look.

Getting Started

Install

Install from npm:

npm i dha-zoomable-image

ZoomImage Component

Props

NameTypeDefaultDescription
srcstringThe source of the image to be displayed.
altstring?The alt text for the image.
imageOptionsImageOptions?{ scrollSensitivity: 0.005, maxZoom: 1, minZoom: 0.5 }The options for the image.

ImageOptions

NameTypeDefaultDescription
scrollSensitivitynumber?0.005The sensitivity of the scroll wheel.
maxZoomnumber?1The maximum zoom level.
minZoomnumber?0.5The minimum zoom level.

Home.tsx - Functional component

import { ZoomImage } from 'dha-zoomable-image';
import React from 'react';

import Logo from '@/assets/images/<image>.webp';

const Home = () => (
  <>
    <ZoomImage src={Logo} />
  </>
);

export default Home;

Home.tsx - Functional component with options

import { ZoomImage } from 'dha-zoomable-image';
import React from 'react';

import Logo from '@/assets/images/<image>.webp';

const Home = () => (
  <>
    <ZoomImage
      src={Logo}
      imageOptions={{
        scrollSensitivity: 0.01,
        maxZoom: 1.5,
        minZoom: 0.5,
      }}
    />
  </>
);

export default Home;

NPM

https://www.npmjs.com/package/dha-zoomable-image

1.4.0

2 months ago

1.3.1

8 months ago

1.2.0

11 months ago

1.1.0

1 year ago

1.0.0

1 year ago